Write a program which reads user input using scanner print


Objectives:

Write a program which reads User Input using Scanner

Print formatted output using printf or DecimalFormat

Practice programming simple mathematical calculations

Instructions:

Samwise Gamgee has finally decided to submit his expense report for all of his adventures regarding his travels to Mordor. Part of those expenses are his stay at the Prancing Pony Inn located in Bree.

You are to write a simple Java program which will generate an Invoice for his stay at the Inn.

Your program should ask for user input which represents the following information:

the number of nights Sam stayed at the Inn

the tax rate for the taxes collected by the Shire

the tax rate for the taxes collected by the City of Bree

cost per night of staying at the Inn

The program should then print out an Invoice which is similar to:

The Prancing Pony Inn, City of Bree, Shire

Invoice for Samwise Gamgee

Cost per night: $110

Shire Taxes per night: @Rate of 6.75% is $7.42

City of Bree Taxes per night: @Rate of 1.25% is $1.37

Total Cost per night: $118.79

Number of nights Stayed: 4

Total Cost: $475.16

(Bonus: Change the program so that the name of the Person and the two Tax Districts can also be entered by the user. These names should be allowed to contain spaces)

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program which reads user input using scanner print
Reference No:- TGS02878115

Expected delivery within 24 Hours