Home  | 

 

ONLINE SESSION B

 

 

 

 

Chapter Five Review

 

Solve both of the following ‘Programming Challenges’ from  ch 5

 

RETAIL PRICE CALCULATOR

 

Start by writing  the entire program without using methods by inputting wholesale cost and markup percentage and then computing the retail price, and then printing the retail price.  Test and run it

 

Next,  modify the  above ‘perfect’ program by moving the computation of retail price to a method named ‘calculateRetail’  This method gets sent the cost and markup from the main method and returns the retail price to the main method.  Print the retail price from the main method. 

 

RECTANGLE AREA

 

Open the AreaRectangle.java program from the chapter 5 code folder that you downloaded.

 

Next,  assuming that you use Scanner, all you have to do is import Scanner and then add the 4 methods to the AreaRectangle.java program

 

One method asks for the length – use Scanner

 

One method asks for the width – use Scanner

 

One method asks for the area  [length times width]  simple calculation

 

One method asks you to print length, width and area

By using System.out.println


 

Chapter Six Review

 

Solve both of the following ‘Programming Challenges’ from  ch 6

 

 

 

The EMPLOYEE CLASS challenge from ch 6

 

Use the data for the 3 employees shown in the textbook

 

 

 

Then solve

 

 

 

 

The RETAIL ITEM  CLASS challenge from ch 6

 

 

Use the data for the 3 retail items  shown in the textbook