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

  Computing the time complexity using the big-o notation

You are required to calculate the time complexity using the big-O notation of the Algorithm_2 given by the following methods defined by the following Java code.

  Distance traveled modification

Distance Traveled Modification

  How does a client send a string ti the server using udp

How does a client send a string ti the server using UDP? Show what the client would do to get data from some string, and create a datagram packet destined for a server at "www.google.com", port 12345.

  Create an array of five employee objects

Create an array of five Employee objects. Prompt the user to enter data for each Employee. Do not allow duplicate ID numbers to be entered.

  Create an application that will allow a new customer

Create an application that will allow a new customer to order a house. You'll allow the customer to choose among four models (Aspen, Britattany, Colonial, and Dartmoor) by creating separate ButtonGroups.

  Automated code coverage and cyclomatic complexity analyses

Automated code coverage and cyclomatic complexity analyses -

  Java application to display multiple choice questions

Write down the application which displays series of TEN(10) multiple choice questions: questions must cover all the Java. Each question must have four possible answers and only one answer must be correct.

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  A mini game made in java using zen graphics

a mini game made in Java using Zen graphics .

  Will the direction and magnitude be integers or doubles

Define a Physics_vector class which consists of a struct containing the direction and magnitude, and also define a function

  Calculates the product of the following sequence

Write a java code that calculates the product of the following sequence of numbers using for/loop and do/while/loop

  Allows a user to select a favorite basketball team

Write an application that allows a user to select a favorite basketball team from a list box. Include at least five teams in the list, and display the chosen team in a text field after the user makes a selection. Save the file as JBasketball.java. :

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