Question: The initial value of numLaptops is read from input. Assign numDesktops with the sum of numLaptops and 5 . Then, assign numLaptops with the same

The initial value of numLaptops is read from input. Assign numDesktops with the sum of numLaptops and 5. Then, assign numLaptops with the same value as numDesktops. Lastly, assign totalComputers with the sum of numLaptops and numDesktops.
Click here for example
Ex: If the input is 8, then the output is:
13 laptops
13 desktops
26 total
import java.util.Scanner;
public class LabData {
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
int numLaptops;
int numDesktops;
int totalComputers;
numLaptops = scnr. nextInt () ;
numDesktops = numLaptops;
numLaptops = numDesktops +4 ;
/*2.2.5 level 4 Jaelyn King */
totalComputers = numLaptops + numDesktops;
System.out.println(numLaptops + "laptops");
System.out.println(numDesktops + "desktops");
}
 The initial value of numLaptops is read from input. Assign numDesktops

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!