Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

What is the "bigger fool theorem" of valuation?

Answered: 1 week ago

Question

OUTCOME 3 Describe pay equity and strategies for implementing it.

Answered: 1 week ago