Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien
logo-home
Solutions Manual For Objects First with Java, A Practical Introduction Using BlueJ, 6th Edition, Barnes, Kölling €27,39   Ajouter au panier

Examen

Solutions Manual For Objects First with Java, A Practical Introduction Using BlueJ, 6th Edition, Barnes, Kölling

 4 vues  0 fois vendu
  • Cours
  • Java
  • Établissement
  • Java

Solutions For Objects First with Java 6th Edition / Objects First with Java 6e Solutions Manual. Objects First with Java, Sixth Edition Solutions Manual Barnes / Solutions For 9780134477367, David J. Barnes, Michael Kölling.

Aperçu 4 sur 126  pages

  • 22 octobre 2024
  • 126
  • 2024/2025
  • Examen
  • Questions et réponses
  • Java
  • Java
avatar-seller
SOLUTIONS MANUAL

Objects First with Java
A Practical Introduction Using BlueJ, 6TH EDITION

Exercise 1.3
Use a negative parameter value to move left, e.g. -70

Exercise 1.9
The House Picture

The main building:

 Create a new Square object
 Invoke its method makeVisible()
 Make the square bigger by invoking the method changeSize(newSize)
(100 is a good size)
 Move the square down by invoking the method moveVertical(distance)
(again 80 is a good value)

The window:

 Create a new Square object.
 Invoke its method makeVisible()
 Change its color by invoking changeColor()
 write "black" in the popupwindow
 Move the square down by invoking the method moveVertical(distance)
(100 is a good value)
 Move it to the right by invoking moveRight()

The roof:

 Create a new triangle object.
 Invoke its method makeVisible()
 Change its size with changeSize(newHeight, newWidth) (50,140)
 moveVertical(70)
 moveHoizontal(60)

The sun:

 Create new Circle object.
 Invoke its method makeVisible()
 Change its color by invoking changeColor() (write "yellow" in the popup
window) Optionally change its size with changeSize(60)
 Move it to the right by invoking moveHorizontal(180)

The Hilltop Picture

The hill:

,  Create a new Circle object.
 Invoke its makeVisible() method.
 Change its color by invoking changeColor (write “green” in the popup
window) Change its size with changeSize to something like 1000.
 Move it left with moveHorizontal(-500).
 Move it down with moveVertical(125).

The sun:

 Create a Circle.
 Make it visible.
 Set its size to 30.
 Move it right by 150 pixels.
 Move it down by 50 pixels.

The larger figure:

 Create a new Person object.
 Invoke its makeVisible method.
 Change its size to something like 50 high and 25 wide.
 Move it left by 30 pixels and up by around 8.

The smaller figure:

 The size should be around 40 by 20.
 Move it left by 3 pixels and down by 2.


Exercise 1.14
 It uses the objects of the classes Circle, Square and Triangle.
 It then moves these objects to the right places and changes the sizes and
colors of the objects. Essentially calling the same methods as used in
exercise 1.9


Exercise 1.16
Change:

sun.changeColor("yellow");

to be:

sun.changeColor("blue");

Note that this change should be made in both the draw() and setColor()
methods. Students often forget to do it in the latter. Illustrate the problem by

,drawing the picture, then calling setBlackAndWhite() then setColor() – the sun
will have been changed to yellow, rather than blue, if the second change is not
made.

Exercise 1.17
The second sun will need to be positioned somewhere different from the first
sun to be visible. As with the previous exercise, it is common for students to
miss the need to change the setColor and setBlackAndWhite methods for
compatibility with the addition. This is an earlier introduction to the need for
regression testing!

Exercise 1.18
After the line sun.makeVisible() insert the following:

 sun.slowMoveVertical(250);
 Compile the Picture class (Press compile in the editor window)
 Create instance of class Picture and invoke its draw() method.


Exercise 1.19
Remove the line (if added in the previous exercise): slowMoveVertical(250);
Right below the last } after the draw() method, add the sunset() method :

/**
* Animates the sunset.
*/
public void sunset()
{
sun.slowMoveVertical(250);
}

Compile! And run it.

Exercise 1.20
Define a new field:

private Person person;

Initialize and position them in the draw():

person = new Person();
person.changeSize(80, 40);
// Place them at ground level.
person.moveVertical(15);
// Make sure they are to the right of the house to start.
person.moveHorizontal(200);

, Make them visible and move up to the house in sunset():

person.makeVisible();
// Walk up to the house.
person.slowMoveHorizontal(-150);

Exercise 1.22
When calling the method getName(), the name of the student is displayed in a
popup window. The name displayed is the one typed in when the object was
created.

Exercise 1.24
It shows the number of students in the LabClass which is zero.

Exercise 1.31
Students looking these values up in the tutorial might not be able to readily
identify that the integer types used here are int, as opposed to byte, short or
long. Similarly, they may well suggest float rather than double for the final one.
Be sure to point out that String always has an initial upper-case letter, because
these subtleties are often missed.

0 int
"hello" String
101 int
-1 int
true boolean
"33" String
3.1415 double

Exercise 1.32
First you would have to decide which type the field should have. String would
be a good type to hold a name, so we add the following line to the source file of
Circle:
private String name;

The above line could be placed after this line in the source code of the Circle
class:

private boolean isVisible;

Exercise 1.33

Les avantages d'acheter des résumés chez Stuvia:

Qualité garantie par les avis des clients

Qualité garantie par les avis des clients

Les clients de Stuvia ont évalués plus de 700 000 résumés. C'est comme ça que vous savez que vous achetez les meilleurs documents.

L’achat facile et rapide

L’achat facile et rapide

Vous pouvez payer rapidement avec iDeal, carte de crédit ou Stuvia-crédit pour les résumés. Il n'y a pas d'adhésion nécessaire.

Focus sur l’essentiel

Focus sur l’essentiel

Vos camarades écrivent eux-mêmes les notes d’étude, c’est pourquoi les documents sont toujours fiables et à jour. Cela garantit que vous arrivez rapidement au coeur du matériel.

Foire aux questions

Qu'est-ce que j'obtiens en achetant ce document ?

Vous obtenez un PDF, disponible immédiatement après votre achat. Le document acheté est accessible à tout moment, n'importe où et indéfiniment via votre profil.

Garantie de remboursement : comment ça marche ?

Notre garantie de satisfaction garantit que vous trouverez toujours un document d'étude qui vous convient. Vous remplissez un formulaire et notre équipe du service client s'occupe du reste.

Auprès de qui est-ce que j'achète ce résumé ?

Stuvia est une place de marché. Alors, vous n'achetez donc pas ce document chez nous, mais auprès du vendeur docusity. Stuvia facilite les paiements au vendeur.

Est-ce que j'aurai un abonnement?

Non, vous n'achetez ce résumé que pour €27,39. Vous n'êtes lié à rien après votre achat.

Peut-on faire confiance à Stuvia ?

4.6 étoiles sur Google & Trustpilot (+1000 avis)

80796 résumés ont été vendus ces 30 derniers jours

Fondée en 2010, la référence pour acheter des résumés depuis déjà 14 ans

Commencez à vendre!
€27,39
  • (0)
  Ajouter