Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1.1 Create another circle. Then create a square. Exercise 1.3 Try invoking the moveVertical, slowMoveVertical, and changeSize methods before you read on. Find out

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Exercise 1.1 Create another circle. Then create a square. Exercise 1.3 Try invoking the moveVertical, slowMoveVertical, and changeSize methods before you read on. Find out how you can use moveHorizontal to move the circle 70 pixels to the left. Exercise 1.4 Invoke the changeColor method on one of your circle objects and enter the string "red". This should change the color of the circle. Try other colors. Exercise 1.5 This is a very simple example, and not many colors are supported. See what happens when you specify a color that is not known. Exercise 1.6 Invoke the changeColor method, and write the color into the parameter field without the quotes. What happens? Exercise 1.9 Figure 1.8 shows two different images. Choose one of these images and recreate it using the shapes from the figures project. While you are doing this, write down what you have to do to achieve this. Could it be done in different ways? Exercise 1.21 Create an object of class Student. You will notice that this time you are prompted not only for a name of the instance, but also for some other parameters. Fill them in before clicking OK. (Remember that parameters of type String must be written within double quotes.) Exercise 1.22 Create some Student objects. Call the getName method on each object. Explain what is happening. Exercise 1.23 Create an object of class Labclass . As the signature indicates, you need to specify the maximum number of students in that class (an integer). Exercise 1.24 Call the numberOfStudents method of that class. What does it do? Exercise 1.25 Look at the signature of the enrollstudent method. You will notice that the type of the expected parameter is Student. Make sure you have two or three students and a Labclass object on the object bench, then call the enrollstudent method of the Labclass object. With the input cursor in the dialog entry field, click on one of the student objects; this enters the name of the student object into the parameter field of the enrollStudent method (Figure1.9 9). Click OK and you have added the student to the Labclass . Add one or more other students as well. Exercise 1.26 Call the printList method of the Labclass object. You will see a list of all the students in that class printed to the Blue terminal window (Figure 1.10 9). BlueJ: Method Call // Add a student to this LabClass. void enrollStudent (Student newStudent) labClass1.enrollStudent ( student1 Cancel Ok Exercise 1.27 Create three students with the following details: Snow White, student ID: A00234, credits: 24 Lisa Simpson, student ID: C22044, credits: 56 Charlie Brown, student ID: A12003, credits: 6 Then enter all three into a lab and print a list to the screen. Exercise 1.28 Use the inspector on a Labclass object to discover what fields it has. Exercise 1.29 Set the instructor, room, and time for a lab, and print the list to the terminal window to check that these new details appear. Exercise 1.1 Create another circle. Then create a square. Exercise 1.3 Try invoking the moveVertical, slowMoveVertical, and changeSize methods before you read on. Find out how you can use moveHorizontal to move the circle 70 pixels to the left. Exercise 1.4 Invoke the changeColor method on one of your circle objects and enter the string "red". This should change the color of the circle. Try other colors. Exercise 1.5 This is a very simple example, and not many colors are supported. See what happens when you specify a color that is not known. Exercise 1.6 Invoke the changeColor method, and write the color into the parameter field without the quotes. What happens? Exercise 1.9 Figure 1.8 shows two different images. Choose one of these images and recreate it using the shapes from the figures project. While you are doing this, write down what you have to do to achieve this. Could it be done in different ways? Exercise 1.21 Create an object of class Student. You will notice that this time you are prompted not only for a name of the instance, but also for some other parameters. Fill them in before clicking OK. (Remember that parameters of type String must be written within double quotes.) Exercise 1.22 Create some Student objects. Call the getName method on each object. Explain what is happening. Exercise 1.23 Create an object of class Labclass . As the signature indicates, you need to specify the maximum number of students in that class (an integer). Exercise 1.24 Call the numberOfStudents method of that class. What does it do? Exercise 1.25 Look at the signature of the enrollstudent method. You will notice that the type of the expected parameter is Student. Make sure you have two or three students and a Labclass object on the object bench, then call the enrollstudent method of the Labclass object. With the input cursor in the dialog entry field, click on one of the student objects; this enters the name of the student object into the parameter field of the enrollStudent method (Figure1.9 9). Click OK and you have added the student to the Labclass . Add one or more other students as well. Exercise 1.26 Call the printList method of the Labclass object. You will see a list of all the students in that class printed to the Blue terminal window (Figure 1.10 9). BlueJ: Method Call // Add a student to this LabClass. void enrollStudent (Student newStudent) labClass1.enrollStudent ( student1 Cancel Ok Exercise 1.27 Create three students with the following details: Snow White, student ID: A00234, credits: 24 Lisa Simpson, student ID: C22044, credits: 56 Charlie Brown, student ID: A12003, credits: 6 Then enter all three into a lab and print a list to the screen. Exercise 1.28 Use the inspector on a Labclass object to discover what fields it has. Exercise 1.29 Set the instructor, room, and time for a lab, and print the list to the terminal window to check that these new details appear

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Know what customers expect from the firm when they complain.

Answered: 1 week ago

Question

Understand why customers complain.

Answered: 1 week ago