Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In which format and how to save this file so that it would run ? import java.util.Scanner; public class Calculator { static Scanner scan =

In which format and how to save this file so that it would run ?


import java.util.Scanner; public class Calculator { static Scanner scan = new Scanner(System.in); public static int Modulus() { System.out.println("Enter Dividend: "); int Dividend=Integer.parseInt(scan.nextLine()); System.out.println("Enter Divisor: "); int Divisor=Integer.parseInt(scan.nextLine()); int Mod=Dividend % Divisor; return Mod; } public static int Division () { System.out.println("Enter Dividend: "); int Dividend=Integer.parseInt(scan.nextLine()); System.out.println("Enter Divisor: "); int Divisor=Integer.parseInt(scan.nextLine()); int Quotient=Dividend/Divisor; return Quotient; } public static double Exponential(int Base,int Expo) { double Result = Math.pow(Base,Expo); return Result; } public static void main(String[] args) { System.out.println("Enter your name: "); String Name=scan.nextLine(); while(true) { System.out.println("*** "+Name+"'s Arithmetic Calculator ***"); System.out.println("A. Perform Modulus Operation"); System.out.println("B. Perform Division Operation"); System.out.println("C. Perform Exponential Operation"); System.out.println("D. Quit program"); System.out.println(" Enter Your Choice Out of A,B,C or D"); String Choice=scan.nextLine(); if(Choice.equals("A")) { System.out.println(" Remainder is : "+Modulus()); } else if(Choice.equals("B")) { System.out.println(" Quotient is: "+Division()); } else if(Choice.equals("C")) { System.out.println("Enter Base: "); int Base=Integer.parseInt(scan.nextLine()); System.out.println("Enter Exponent: "); int Expo=Integer.parseInt(scan.nextLine()); System.out.println(" "+Base+"^"+Expo+":"+Exponential(Base,Expo)); } else if(Choice.equals("D")) { System.out.println(" Thank you for using my program "); System.exit(0); } else { System.out.println(" Sorry !!! Wrong Input. It must be A,B,C or D"); } } } } 


Step by Step Solution

There are 3 Steps involved in it

Step: 1

To save the provided Java code so that it runs correctly follow these steps 1 Save the File Copy the ... 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_2

Step: 3

blur-text-image_3

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

Using Microsoft Excel and Access 2016 for Accounting

Authors: Glenn Owen

5th edition

1337109048, 1337109045, 1337342149, 9781337342148 , 978-1337109048

More Books

Students also viewed these Programming questions

Question

What did Jung mean by the term archetype? Provide examples.

Answered: 1 week ago

Question

-x/2 x/4 If A = -x/2 and A-1 =6 then x equals

Answered: 1 week ago

Question

How does the AutoFill feature of Excel help the worksheet user?

Answered: 1 week ago

Question

What is a parameter query?

Answered: 1 week ago

Question

What is the Page Layout view?

Answered: 1 week ago