1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
antoniya [11.8K]
3 years ago
13

1. Type a statement that reads a user-entered integer into variable numUsers. Assume scnr already exists.

Computers and Technology
1 answer:
ASHA 777 [7]3 years ago
3 0

Answer:

Question 1:

int numUsers = scnr.nextInt();

Question 2:

public class OutputExample {

public static void main (String [] args) {

int numCars = 99;

Scannerscnr=new Scanner(System.in);

numCars=scnr.nextInt();

System.out.println("There are "+numCars+" cars");

return;

}

}

Question 3:

import java.util.Scanner;

public class Errors {

public static void main(String [] args) {

int userNum = 5;

System.out.println ("Predictions are hard. ");

System.out.print("Especially ");

System.out.print("about the future.");

System.out.println("Num is: "+userNum);

return;

}

}

Explanation:

In Question 1, the statement int numUsers = scnr.nextInt();  reads a new integer value from the keyboard and assigns it to the variable numUsers.

In question 2, Concatenation is used to format the print output.

In question 3, care is taken to fix each of the syntax errors (missing double quotes, semi-colon, concatenation)

You might be interested in
The full meaning of UNIVAC and ENIAC​
I am Lyosha [343]

Explanation:

ENIAC - Electronic Numerical Integrator and Calculator. UNIVAC - Universal Automatic Computer (First Digital Computer)

hope it's help you cutty

8 0
2 years ago
Read 2 more answers
Write a program that reads a stream of integers from a file and writes only the positive numbers to a second file. The user shou
borishaifa [10]

Answer:

See explaination for thr program code.

Explanation:

import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.FileWriter;

import java.io.IOException;

import java.io.OutputStream;

import java.io.PrintWriter;

import java.util.Scanner;

public class ReadWriteInt

{

public static void main(String args[]) throws IOException

{

Scanner input=new Scanner(System.in);

System.out.println("Enter the name of the input file:");

String inputFile=input.next();

System.out.println("Enter the name of the output file:");

String outputFile=input.next();

File fin=new File(inputFile);

File fout=new File(outputFile);

//print error, if input file does not exist

if(!fin.exists())

{

System.out.println("Error:Input file does not exist");

System.exit(0);

}

//print error, if output file does not exist

if(!fout.exists())

{

System.out.println("Error:output file does not exist");

System.exit(0);

}

//input stream to read

Scanner read=new Scanner(fin);

OutputStream os=new FileOutputStream(fout);

//output stream to write

PrintWriter write=new PrintWriter(os,true);

//read from input file until there are no numbers

while(read.hasNextLine())

{

String num=read.nextLine();

//convert the string into number

int number=Integer.parseInt(num);

//if the number is positive , write it to out put file

if(number>=0)

{

write.println(number);

System.out.println(number);

}

}

System.out.println("Positive numbers are copied successfully");

}

}

Please check attachment for screenshot and output

5 0
3 years ago
Why is it important to use random assignment when determining which research participants will comprise the different treatment
Temka [501]

Explanation:

using random assignment keeps the study from becoming biased or untestable. it gives the results validity.

8 0
3 years ago
I will give Brainliest and Extra points for correct answers!!!
AlexFokin [52]
Autauga Alabama 55,869
Baldwin Alabama 223,234
Barbour Alabama 24,686
3 0
2 years ago
Read 2 more answers
Using a pin or password in addition to tpm is an example of what type of authentication?
anzhelika [568]
Considering it is private i would say security?
3 0
3 years ago
Other questions:
  • What was the han dynasty and the roman empire known for?
    5·1 answer
  • _____________ is the characteristic of a resource that ensures that access is restricted to only permitted users, applications,
    14·1 answer
  • What is AI and its necessary types?
    6·1 answer
  • Ben's team is working on an English project. The members want to see everyone's progress on their part of the project. What tech
    7·2 answers
  • What is the name for the type of flash memory that is used by mobile devices to store their apps and data?
    6·1 answer
  • I have $80 and I want a smartphone that you can call for free what should I get
    14·2 answers
  • Which of the following is true about scalability?
    9·1 answer
  • What does a coder do on a daily basis?
    8·1 answer
  • You were recently hired by a small start-up company. The company is in a small office and has several remote employees. You have
    15·1 answer
  • Is y0utube an example of unsupervised learning or supervised learning?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!