Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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");
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

Students also viewed these Databases questions

Question

What are your key strengths as a trainer?

Answered: 1 week ago