Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please add comments for important steps, so I can learn about them each compare them to my own program and hopefully learn something new. Math

image text in transcribedimage text in transcribed

Please add comments for important steps, so I can learn about them each compare them to my own program and hopefully learn something new.

Math Tutor (MathTutor java) [10 pts.] Write a program that lets the user enter 2 numeric values, and an arithmetic operator:+, and/. Write a switch statement that displays the result of the calculation using the operator and two numbers entered by the user. Remember that the division must have decimals and you need to validate the operator and display a proper message when the user enters a non-valid operator EasyMoney java-An imaginary lott ery 110 pts.I import java.util.Scanner: /* The following program was developed to simulate a lottery game called BasyMoney The program random selects a two-digit winner, prompts the user for their pick, "and then determines the amount the user wins based on the following rules: a. The user matches both numbers in the exact order -$100 b. If all the digits match, but not in the correct order $10 c. If one digit matches a lottery number 1 public class EasyMoney f public static void main(Stringl args) t /% Generate a lottery int easymoneynumbers (int) (Math. random) 100); /7 Prompt the user to enter a guess Scanner input new Scanner (System. in) system. out.print ("Enter your BasyMoney pick (two digits): ) int guess-input.nextInt /7 Get digits from EasyMoney int easymoneyDigiti - easymoneynumbers / 10 int easymoneyDigit2 easymo neynumbers %; 10; int quessDigiti guess / 10: int guessDigit2 quess 10 Page I of 2 system. out.printin ("The EasyMoney number is " easymoneynumbers); // Check the guess if (guess easymoneynumbers) System. out.println ("Exact match: you win $100) else if (guessDigit2 easymoneyDigitl &&guessDigitl easymoneyDigit2) System.out.printin ("Match all digits: you win $10") else if (guessDigitleasymoneyDigitl 11 guessDigit1 easymoneyDigit2 11 guessDigit2s easymoneyDigitl i guessDigit2easymoneyDigit2) System.out.println ("Match one digit: you win $1") else system.out.printin ("Sorry, no match") Using the above listing as an example, convert EasyMoney to a three-digit number playing game. In your revision of EasyMoney (EasyMoney java), the user should enter a three-digit number instead of a two digit numbers. The following rules are slightly modified for the new game. a. If the user matches all three numbers in the exact order- $900 b. If the user matches all the numbers but not in the exact order $180 c. If one digit matches the EasyMoney numbers -$8

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

Students also viewed these Databases questions

Question

=+Among other internal publics?

Answered: 1 week ago

Question

Predict the major product of the reaction shown. II III IV

Answered: 1 week ago

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

What is the best conclusion for Xbar Chart? UCL A X B C B A LCL

Answered: 1 week ago