Consider the following program. Modify the code to use a Scanner to prompt the user for the
Question:
Consider the following program. Modify the code to use a Scanner to prompt the user for the values of low and high .
Below is a sample execution in which the user asks for the sum of the values 1 through 10:
low? 1
high? 10
sum = 55
Transcribed Image Text:
public class SumNumbers { public static void main (String[] args) { 3. int low = 1; 4 int high = 1000; int sum = 0; 6. for (int i = low; i <= high; i++) { 7. sum += i: 8. } 9 System.out.println ("sum = " + sum); 10 11 2. 5.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (10 reviews)
public class ModifyScanner param args the command l...View the full answer
Answered By
Sandip Nandnawar
I am a B.E (Information technology) from GECA and also have an M.C.M from The University of RTMNU, MH.
I worked as a software developer (Programmer and TL). Also working as an expert for the last 6 years and deal with complex assessment and projects. I have a team and lead a team of experts and conducted primary and secondary research. I am a senior software engg and senior expert and deal with all types of CSE and IT and other IT-related assessments and projects and homework.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted:
Students also viewed these Computer science questions
-
Consider the following program segment, where i, j, k, n, and counter are integer variables and the value of n (a positive integer) is set prior to this segment. counter : = 0 for i : = 1 to n do for...
-
Consider the following program in Scheme: What does this programprint? What would it print if Scheme used dynamic scoping and shallow binding? Dynamic scoping and deep binding? Explain your answers....
-
Consider the following program which provides a software approach to mutual exclusion: Integer array control [1: N]; integer k Where 1 k N, and each element of control is either 0, 1, Or 2. All...
-
You are the senior auditor in charge of the December 31, 2018, year-end audit for Cleo Patrick Cosmetics Inc. (CPCI). CPCI is a large, privately held Canadian company that was founded in 1999 by one...
-
Consider a Carnot refrigeration cycle executed in a closed system in the saturated liquid-vapor mixture region using 0.96 kg of refrigerant-134a as the working fluid. It is known that the maximum...
-
When would you use a button?
-
Water flows through a horizontal bend and discharges into the atmosphere as shown in Fig. P5.38. When the pressure gage reads 10 psi, the resultant \(x\)-direction anchoring force, \(F_{A x}\), in...
-
Using the information provided in exercise 64, prepare the reconciliation of operating income to net cash provided by operating activities that would appear at the bottom of the December 31 Statement...
-
Organizational Behavior environment of Salesforce If they don't encourage positive organizational behavior what type oforganizational behavior do they seem to encourage? A conclusion about...
-
The Shamrock Paint Company uses a process-costing system. Materials are added at the beginning of a particular process, and conversion costs are incurred uniformly. Work in process at the beginning...
-
Write Java code that prompts the user for a phrase and a number of times to repeat it, then prints the phrase the requested number of times. Here is an example dialogue with the user: What is your...
-
Write Java code to read an integer from the user, then print that number multiplied by 2. You may assume that the user types a valid integer.
-
Problems 94101 are based on material learned earlier in the course. The purpose of these problems is to keep the material fresh in your mind so that you are better prepared for the final exam. Find...
-
Assume that you work for a company that designs and manufactures uniforms and protective equipment. Your company would like to expand its offerings and is considering manufacturing firefighter...
-
Explain the three criteria for evaluating whether a source is credible.
-
Some students who want to train with an accountancy practice tend to focus exclusively on trying to get a job with one of the Big Four (PwC, Deloitte, EY and KPMG) and ignore smaller accounting firms...
-
You may have no plans to become an accountant in the future. Why is it still important for you to study the basics of accounting, such as those covered in this book?
-
Range, mean, median, and mode are four ways of reporting the quantitative data from a survey. Explain how they differ.
-
An electron is released from rest at the negative plate of a parallel plate capacitor and accelerates to the positive plate (see the drawing). The plates are separated by a distance of 1.2 cm, and...
-
D Which of the following is considered part of the Controlling activity of managerial accounting? O Choosing to purchase raw materials from one supplier versus another O Choosing the allocation base...
-
How do guided media differ from unguided media?
-
Name the two major categories of transmission media.
-
Using Figure 7.6, tabulate the attenuation (in dB) of a 18-gauge UTP for the indicated frequencies and distances. Figure 7.6 26 gauge Gauge Diameter (inches) 0.0403 20 24 gauge 18 18 0.02320 22...
-
Assume that a robot systems constant failure and repair rates are 0.0004 failures per hour and 0.002 repairs per hour, respectively. Calculate the robot system steady-state unavailability and...
-
March 6, 2018 David Beckham's Latest Pitch: Men's Cosmetics. By Robert Williams Men of the world, David Beckham has a message for you: Moisturize. "It's the biggest thing," he says in a London...
-
3. On January 1, an investment fund was opened with an initial balance of 5000. Just after the balance grew to 5200 on July 1, an additional 2600 was deposited. The annual effective yield rate for...
Study smarter with the SolutionInn App