Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program using basic beginners JAVA.. (*no use of while loops*) In predecimalization Britain, a British pound was divided into 20 shillings, and a shilling was

Program using basic beginners JAVA.. (*no use of while loops*)

In "predecimalization" Britain, a British pound was divided into 20 shillings, and a shilling was divided into 12 pence ("pence" being their plural of "penny"). For lunch one day, Jack decides to have a steak and kidney pie and beer. Write a program to determine the change Jack will receive from having a pie and pint. Your program should ask for the amount of money that Jack has, and for the price of the pie, and the price of the beer, each in pounds/shillings/pence amounts. Output the pounds/shillings/pence change Jack will receive. Your output should report as many pounds as possible, less than 20 shillings and less than 12 pence. You may assume that input for shillings will be less than 20, and that input for pence will be less than 12. You may also assume that the cost of the lunch will not exceed the amount of money Jack has.

The following is a sample execution:

Enter the pounds that Jack has: 4

Enter the shillings that Jack has: 10

Enter the pence that Jack has: 6

Enter the pounds for the pie: 1

Enter the shillings for the pie: 2

Enter the pence for the pie: 3

Enter the pounds for the beer: 1

Enter the shillings for the beer: 12

Enter the pence for the beer: 0

Jack's change is 1pounds 16shillings 3pence

Hint: convert everything to pence, figure out Jack's change, and then convert the change to pounds, shillings and pence. Grading Elements:

The program should Ask and use the amount of money Jack has in pounds, shillings and pence Ask and use the cost of a steak and kidney pie in pounds, shillings and pence Ask and use the cost of a pint of beer in pounds, shillings and pence Correctly calculate Jack's change Correctly display Jack's change in pounds, shillings and pence

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Evaluate the importance of diversity in the workforce.

Answered: 1 week ago

Question

Identify the legal standards of the recruitment process.

Answered: 1 week ago