Basic Algorithms in Java

Programming

Task 1, Value: 5 marks

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.

Task 2, Value: 5 marks

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

Your total bill is: $250

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

Your total bill is: $175

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.

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational