2. Write a Java program that uses switch statement to offer the user 3 choices to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. Write a Java program that uses switch statement to offer the user 3 choices to choose from them: (Total: 6 Marks) - Case 1, the program will ask the user to enter 2 numbers. Then, it will find the sum of them using an external method. - Case 2, the program will ask the user to enter a number. Then, it will print whether the number is Even or Odd. Case 3, the program will ask the user to enter a number. Then, it will check: o If the number is greater than 30 and less than 60, print "Try bigger number" o If the number you entered is greater than or equal to 60 and less than 100, print "The number you entered is accepted" o If the number is less than or equal to 30 or greater than or equal to 100, print "The number you entered is out of range" 2. Write a Java program that uses switch statement to offer the user 3 choices to choose from them: (Total: 6 Marks) - Case 1, the program will ask the user to enter 2 numbers. Then, it will find the sum of them using an external method. - Case 2, the program will ask the user to enter a number. Then, it will print whether the number is Even or Odd. Case 3, the program will ask the user to enter a number. Then, it will check: o If the number is greater than 30 and less than 60, print "Try bigger number" o If the number you entered is greater than or equal to 60 and less than 100, print "The number you entered is accepted" o If the number is less than or equal to 30 or greater than or equal to 100, print "The number you entered is out of range"
Expert Answer:
Answer rating: 100% (QA)
The task outlined in the image is to write a Java program that uses a switch statement to offer the user three choices and to perform different action... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The audiology department at Randall Clinic offers many services to the clinic's patients. The three most common, along with cost and utilization data, are as follows: Service Basic Examination...
-
Discuss what competencies a leader requires to handle complexity. Why are these uniquely necessary for succeeding in complex work environments? with some examples (content should be in at least 2...
-
Figure 6 shows two blocks joined with a rope that runs over a pulley. The mass of m2 is 5.0 kg, and the incline is 35. The coefficient of static friction between m, and the inclined plane is 0.25....
-
Describe the risk assessment approach used for Enterprise Risk Management(ERM) at Worker's Compensation Fund(WCF). How does this approach compare to ISO 31000? Does it consider risks with upside...
-
For the year ended December 31, 2015, Kadmen Ltd. incurred the following transactions related to the purchase of a property. Assume all transactions are for cash unless otherwise stated. Jan. 22...
-
On September 1, 2022, Winans Ltd. acquired Aumont Enterprises for a cash payment of 700,000. At the time of purchase, Aumonts statement of financial position showed assets of 620,000, liabilities of...
-
Under CCP 581(b)(1), barring certain exceptions, without a court order a plaintiff has an absolute right to dismiss his or her complaint any time before the commencement of trial. Further investigate...
-
First National Bank hired Longdon as a secretary and obtained a surety bond from Belton covering the bank against losses up to $100,000 resulting from Longdons improper conduct in the performance of...
-
2. Analyze the function f(x)=-(x-1) (x+1) (x+3) to identify its key characteristics then carefully sketch its graph. Produce the leading term and constant term below: a) Degree = c) y intercept = b)...
-
628 Company is considering the purchase of equipment that would allow the company to add a new product to its line. The equipment costs $192,000 and has a 12-year life and no salvage value. The...
-
Below is a description of each of the tabs in the Excel file, plus the required questions to be answered. It is up to the participant to create a chart and/or table summary for presentation to answer...
-
The fifth string on a guitar plays the musical note A, at a frequency of 110 Hz. On a typical guitar, this string is stretched between two fixed points 0.64 m apart, and this length of string has a...
-
Dr. Padma Singh, Director of Emergency Medicine at Westlake Hospital, collapsed into her desk chair with a sigh, being careful to avoid spreading the blood stain on her shirt to the chair fabric....
-
1. Alishba wakes up late and runs to school, covering a distance of 2.55 km in a direction of [N20 degrees E] as measured from her home. She then realizes that her friend Hawi has her homework and...
-
Warnerwoods Company uses a perpetual inventory system. It entered into the following purchases and sales transactions for March. Date March 1 Activities Beginning inventory Purchase March 5 March 9...
-
A rectangular beam of width 300mm and overall depth 450mm is subjected to a factored shear of 350 KN. The tension side is provided with 4- 20mm dia bars. Assuming M25 grade of concrete, clear cover...
-
Find the intercepts and then graph the line. (a) 2x - 3y = 6 (b) 10 - 5x = 2y
-
Consider the TooBig functor in Listing 16.15.What does the following code do, and what values get assigned to bo? bool bo = TooBig(10)(15); One functor (f100) is a declared object, and the second...
-
What storage scheme would you use for the following situations? a. Homer is a formal argument (parameter) to a function. b. The secret variable is to be shared by two files. c. The topsecret variable...
-
Do Programming Exercise 6, but instead of declaring an array of three CandyBar structures, use new to allocate the array dynamically. Data From Exercise 6 The CandyBar structure contains three...
-
The mean free path \(\lambda\) of a molecule of gas is the average distance it travels before collision with another molecule. It is given by \[\lambda=C \frac{m}{ho d^{2}}\] where \(m\) and \(d\)...
-
A rectangular gate (width \(w=2 \mathrm{~m}\) ) is hinged as shown, with a stop on the lower edge. At what depth \(H\) will the gate tip? Water H 0.55 m 0.45 m P3.46 Hinge Stop
-
Gates in the Poe Lock at Sault Ste. Marie, Michigan, close a channel \(W=34 \mathrm{~m}\) wide, \(L=360 \mathrm{~m}\) long, and \(D=10 \mathrm{~m}\) deep. The geometry of one pair of gates is shown;...
Study smarter with the SolutionInn App