# Basic Algorithms in Java

Write a complete Java program with the following functionality:

• Displays a welcoming message such as:

Welcome to Numbers Program!

• Prompts the user twice to enter two positive whole numbers (integers) where the value of the first number is smaller than the last one
• Calculates the square and the cube of each number from the first value to the last one inclusive and then displays an appropriately labeled, three column table, with each row containing the number, its square and its cube respectively
• It then displays the total of each column below the table (the sum of numbers, squares and cubes from first to last)
• Finally, it displays a farewell message such as:

Thank you for using our program!

As an example, if the first and last values entered by the user were 1 and 3 respectively, the table in the output would look something like the following:

Number Square Cube

1 1 1

2 4 8

3 9 27

Total: 6 14 36

You may assume that the user of the program enters the inputs as required (inputs are integers and the first one is smaller than the last one) so that no input validation or error checking is necessary.

Ensure that the program is appropriately documented throughout and thoroughly tested to demonstrate its correct operation.

Write a complete Java program designed to calculate the total charge corresponding to purchase of books at a fictional Annual Melbourne Book Festival. The price of each book is based on its category as described below:

• Large print hardback books \$20 each or three for \$40
• Small print hardback books \$10 each or two for \$15
• All softcover books \$5 each or four for \$10

The program will continue asking the user to enter the number of books they purchased from each category, calculating bills until the user enters n in response to a final prompt asking if another calculation is required.

An example run of the program might look like the following (user inputs are shown in bold):

Welcome to the Annual Melbourne Book Festival!

Enter the number of large print hardback books purchased: 7

Enter the number of small print hardback books purchased: 13

Enter the number of softcover books purchased: 17

Would you like to calculate another bill (y/n)? y

Enter the number of large print hardback books purchased: 11

Enter the number of small print hardback books purchased: 0

Enter the number of softcover books purchased: 6

Would you like to calculate another bill (y/n)?n

Total sales in this session: \$425

Goodbye!

You may assume that the user of the program enters the inputs as required so that no input validation or error checking is necessary.

Ensure that the program is appropriately documented throughout and thoroughly tested to demonstrate its correct operation.

##### "Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"  