object oriented programming 9

A skill-testing question, typically an exercise in arithmetic, is attached to many sweepstakes and contests in Canada. (Though not important for this assignment, this is used to work around a Canadian law making it illegal to distribute money or prizes for games of luck. The skill-testing question adds an element of skill to the game, which makes it legal.) A skill-testing question typically looks like the following: What is the answer to 4 + 2 × (8 − 2)/3?

Write a program that solves any skill-testing question in the form 𝑎 + 𝑏 × (𝑐 − 𝑑)/𝑒 for any positive integers 𝑎, 𝑏, 𝑐, 𝑑, and 𝑒. The user should be presented a message on the console to enter the values of 𝑎, 𝑏, 𝑐, 𝑑, and 𝑒, one at a time, and then output the answer of the skill-testing question to the console.

Submit your source code in a file named SkillTest.java!

Sample input and output (inputs preceded by >):

Skill-testing question: a + b * (c – d) / e Please enter a:

>4

Please enter b:

>2

Please enter c:

>8

Please enter d:

>2

Please enter e:

>3

The answer to the skill-testing question is 8.0

Additional practice problems from the textbook: 1.8, 1.11, 2.4, 2.5, 2.6, 2.12, 2.17

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