Create your program using eclipse

Assignment Help JAVA Programming
Reference no: EM13768576

Assignment 5

Goal

In this assignment you will program a menu-based calculator and practice using...
• Switch statements
• Loops

Requirements

Your program will perform one of two options repeatedly until the user quits your program.

• Create your program using Eclipse. Name your project Assignment5 and the Java class Loops.

• Use the Scanner class to get input from the user and use System.out to print to the console window.

• Use a while (or a do...while) to have the program loop until the user enter -1

• Inside the while, display a menu similar to the one below and use switch statement to respond to the user's choice

Please enter one of the following choices:

1 --> Largest Number

2 --> Factorial

-1 --> Quit

• For the Largest Number:

o Use ANOTHER while (or a do...while) loop ask the user to input an integer greater than or equal to 0 or -1 to quit.
Input an integer greater than or equal to 0 or -1 to quit:

o When the user enters -1, print out the largest number found

• For the Factorial:

o Ask the user for an integer that we will calculate the factorial.

o In math the factorial is notated as "n!". It is the product of all positive integers less than or equal to n. For example, 5! =5x4x3x2x1= 120. Meanwhile 3! = 3 x 2 x 1 = 6

o Here are the factorial rules

• If the integer is negative, display an error message

• Else if the integer is 0, then 0! = 1 so automatically print 1 as the answer

• Else calculate the factorial with a for loop and display the result.

o When finished, display the result

o Hint: use the factorial result as a long and not an int as the values can get quite large

• Display the result in a readable format.

• Be sure to comment your code.

Reference no: EM13768576

Questions Cloud

Largest supplier of home goods in the northeast : You are a new procurement manager with the largest supplier of home goods in the Northeast. The owner of the corporation is considering discontinuing the contract for the shipping of goods. He wants the corporation to invest in its own fleet of tr..
Different staffing levels : Analyze the primary way in which different staffing levels may play pivotal roles in upholding ethical conduct, including treating patients with dignity.
What degree you believe harley-davidson is proceeding : Discuss to what degree you believe Harley-Davidson is currently proceeding towards its mission, vision, and values - Identify two or three of H-D's most important stakeholders and discuss whether Harley-Davidson's current strategic direction is alig..
Analysis of an environmental disaster : Recent environmental disasters have significantly impacted the human population in multiple ways. In this assignment, you will identify a recent environmental disaster and discuss potential correlated health impacts.
Create your program using eclipse : Create your program using Eclipse. Name your project Assignment5 and the Java class Loops. Use the Scanner class to get input from the user and use System.out to print to the console window.
What is the companys approach to sustainability : What is the company's approach to outsourcing and/or offshoring? What is the company's approach to sustainability?
Resources to use in researching a bankruptcy issue : What is the standard for a consumer debtor to obtain discharge of a student loan on the grounds of "undue hardship"? Describe the resources to use in researching a bankruptcy issue
Aggregate demand curve is negatively sloped : Aggregate demand curve is negatively sloped in part because of the impact of interest rates and the economy is in short-run equilibrium.
Issues in the automotive technology department : After introducing yourself to the secretary you share with a half dozen other, more senior, people, you decide to focus on hazardous material and hazardous waste issues since you just completed a great college course on those topics. You tour the ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create an array of date objects

Create an array of Date objects of size 4. Initialize the array by using a loop. In the loop, use the Scanner.nextLine() method to input a date as a string, convert it to a date by using the toDate() method, and assign the result to an element in ..

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Write a class called rationalnumber

Write a class called RationalNumber that represents a fraction with an integer numerator and denominator.

  Write a java application to ask number of assignments

Write a java application that accomplishes the following tasks with built in exception handling: ask the number of homework assignment students have submitted in a semester

  What command is used to create a java archive

What command is used to create a Java archive? Describe using an example.

  Creates a file called "grades.txt" with 1000 lines

Write a program that creates a file called "grades.txt" with 1000 lines. Each line in the "grades.txt" file will consist of a student's first name, last name, graduating year(2013,2014,2015), and grade. the student's first name and last name for t..

  Write the string copy and string concatenation functions

Write the string copy and string concatenation functions and first version should use array subscripting, and the second version should use pointer arithmetic.

  Define a simple interface named motorized with one method

question 1 define a simple interface named motorized with one method maxspeed which returns the maximum attainable

  Topics: user interface, input validation, computer security

Topics: user interface, input validation, computer security, i/o processing, storage & retrievalAssignment: Write a program that will simulate a basic registration/login process for a standard application or website.Menu ItemsCreate a profileAsk the ..

  The main method must repeatedly have the use

After the method is defined, the main method must repeatedly have the user enter 3 integers, call the triangleType method and display the return type. Be sure not to have an infinite loop by allowing the user to quit.

  Representing an investment value and interest rate

Write a Java test program, all your code should be in the main method that asks the user for two numbers representing an investment value and interest rate.

  Java program to compute invoice for client

You need a java program to compute the invoice for client and then print out invoice to the screen. The consulting rate is $200 per hour.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd