subject

The following code is poorly structured. rewrite it so that it has a better structure and avoids redundancy. to eliminate redundancy, convert the code into a method named spending that accepts two parameters: a scanner for the console, and a string for a single person's name, and prints the appropriate information about that person's bills. your method could be called twice (once for john and once for jane) to replicate the original code's behavior.

scanner console = new scanner(system. in);
system. out. print("how much will john be spending? ");
double amount = console. nextdouble();
system. out. println();
int numbills1 = (int) (amount / 20.0);
if (numbills1 * 20.0 < amount) {
numbills1++;
}
system. out. print("how much will jane be spending? ");
amount = console. nextdouble();
system. out. println();
int numbills2 = (int) (amount / 20.0);
if (numbills2 * 20.0 < amount) {
numbills2++;
}
system. out. println("john needs " + numbills1 + " bills");
system. out. println("jane needs " + numbills2 + " bills");

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
question
Computers and Technology, 23.06.2019 00:00
What season was better from fortnite?
Answers: 2
question
Computers and Technology, 23.06.2019 21:10
Asample of 200 rom computer chips was selected on each of 30 consecutive days, and the number of nonconforming chips on each day was as follows: 8, 19, 27, 17, 38, 18, 4, 27, 9, 22, 30, 17, 14, 23, 15, 14, 12, 20, 13, 18, 14, 20, 9, 27, 30, 13, 10, 19, 12, 26. construct a p chart and examine it for any out-of-control points. (round your answers to four decimal places.)
Answers: 2
question
Computers and Technology, 24.06.2019 23:40
Which slide should you change so it reflects om all sides of your presentation
Answers: 1
You know the right answer?
The following code is poorly structured. rewrite it so that it has a better structure and avoids red...
Questions
question
Mathematics, 08.12.2020 02:10
question
Medicine, 08.12.2020 02:10
question
Mathematics, 08.12.2020 02:10
Questions on the website: 13722363