Question: Norksheet 1 1 In the main ( ) method, declare and integer variable x . Using a loop, print a countdown from x to 0

Norksheet 1
1 In the main() method, declare and integer variable x. Using a loop, print a countdown from x to 0.
2 Write two methods
a) One to compute the average of two numbers.
Will this method require any inputs?
Will it have a return value?
b) Another method that prints the current age of a student when given the year of birth.
Will this method require any inputs?
Will it have a return value?
3 Consider the methods you wrote in Q2:
a. Can you write the preconditions
b. Can you write the post-conditions?
c. Can you write some statements that detect when the precondition is violated and print a message?
4 Create Project called Practice: Then create a class to represent
a. Pizza
b. Student
c. Car
d. Television
5 Choose another object and come up with three fields. For now, choose fields that are able to be represented as a letter, number, or true/false (primitive data types). Please format in pseudo-UML. ****Must describe an individual thing, not a set. For example: shoe size vs number of shoes
Shoe size is a description of one pair of shoes
Number of shoes is a description of a collection of shoes
6 Open Eclipse and create a project called DogApplication. Create a class based on the following UML:
Dog
isBulldog : boolean
age : int
7 Add a driver class to the DogApplication project
DogDriver
8 Create a constructor in the Dog class that takes two input parameters and uses those parameters to initialize the instance variables.
9 In the main method inside the driver class, declare a variable of type Dog (call it myDog) and instantiate it with value of your choice.
10 In the main method inside the driver class, declare a variable of type Dog (call it yourDog). Instantiate it with appropriate values so that it represents a 2-year-old bulldog.
 Norksheet 1 1 In the main() method, declare and integer variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!