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
kompoz [17]
3 years ago
10

Write an application that inputs three numbers (integer) from a user. (10 pts) UPLOAD Numbers.java a. display user inputs b. det

ermine and display the number of negative inputs c. determine and display the number of positive inputs d. determine and display the number of zero inputs e. determine and display the number of even inputs f. determine and display the number of odd inputs
Computers and Technology
1 answer:
SCORPION-xisa [38]3 years ago
7 0

Answer:

The program to this question as follows:

Program:

import java.util.*; //import package for user input

public class Number //defining class Number

{

public static void main(String[] ak)throws Exception //defining main method

{

int a1,b1,c1; //defining integer variable

int p_Count=0,n_Count=0,n_Zero=0,even_Count=0,odd_Count=0;

Scanner obx=new Scanner(System.in); //creating Scanner class object

System.out.println("Input all three numbers: "); //print message

//input from user

a1=obx.nextInt(); //input value

b1=obx.nextInt(); //input value

c1=obx.nextInt(); //input value

//check condition for a1 variable value

if(a1>0) //positive number

p_Count++;

else if(a1==0) //value equal to 0

n_Zero++;

else //value not equal to 0

n_Count++;

if(a1%2==0)//check even number

even_Count++;

else //for odd number

odd_Count++;

//check condition for b1 variable value

if(b1>0) //positive number

p_Count++;

else if(b1==0) //value equal to 0

n_Zero++;

else //value not equal to 0

n_Count++;

if(b1%2==0) //check even number

even_Count++;

else //for odd number

odd_Count++;

//check condition for c1 variable value

if(c1>0) //positive number

p_Count++;

else if(c1==0) //value equal to 0

n_Zero++;

else //value not equal to 0

n_Count++;

if(c1%2==0) //check even number

even_Count++;

else //for odd number

odd_Count++;

//print values.

System.out.println("positive number: "+p_Count);//message

System.out.println("negative number: "+n_Count); //message

System.out.println("zero number: "+n_Zero); //message

System.out.println("even number: "+even_Count); //message

System.out.println("odd number: "+odd_Count); //message

}

}

Output:

Input all three numbers:

11

22

33

positive number: 3

negative number: 0

zero number: 0

even number: 1

odd number: 2

Explanation:

In the above java program code a class is defined in this class three integer variable "a1,b1, and c1" is defined which is used to take input value from the user end, and other integer variable "p_Count=0, n_Count=0, n_Zero=0, even_Count=0, and odd_Count=0" is defined that calculates 'positive, negative, zero, even, and odd' number.

  • In the next step, the conditional statement is used, in if block a1 variable, b1 variable, c1 variable calculates it checks value is greater then 0, it will increment the value of positive number value by 1.
  • else if it will value is equal to 0. if this condition is true it will negative number value by 1
  • else it will increment zero number values by 1.
  • In this code, another if block is used, that checks even number condition if the value matches it will increment the value of even number by 1, and at the last print, method is used that print all variable values.
You might be interested in
You have created a new dhcp scope with address range 192.168.1.1 to 192.168.1.254. you have five servers configured with static
galben [10]
Reduce the scope to <span>192.168.1.1 .. 192.168.1.239, to avoid conflicting IP's.</span>
6 0
4 years ago
An output device is any hardware component that allows you to enter data and instructions into a computer
Mekhanik [1.2K]

Answer:

Explanation:

Computer accepts some data for its processing, that data is called input. The hardware component which allows user to enter data and instruction into a computer is called input device.

4 0
3 years ago
What features should you look for in a printer? describe at least four in detail.?
zalisa [80]
DPI (Dots per inch), which is the resolution/detail that the printer can print.

Paper size, as you may want to print on a large range of media

Paper type, as conventional printers would print on standard paper, whilst different uses, such as photography, would benefit from printing on higher quality photo paper.

Connectivity, this can range from wireless over WiFi or Bluetooth, wired over Ethernet or USB, or even where you may have to connect a USB/SD card directly into the printer. All of these data transmission solutions would result in their own constraints and benefits.
4 0
4 years ago
What are the two features of EDIAC ?​
Sergio [31]

Answer:

By the numbers: “The ENIAC contained 17,468 vacuum tubes, along with 70,000 resistors, 10,000 capacitors, 1,500 relays, 6,000 manual switches and 5 million soldered joints. It covered 1,800 square feet (167 square meters) of floor space, weighed 30 tons, consumed 160 kilowatts of electrical power.” More info

3 0
3 years ago
¿Que es el simulador de vuelo en Google Earth?
Dimas [21]
Guat da fak did u say 
4 0
3 years ago
Other questions:
  • Electricity was seen as a mysterious force and began to creat a stir when people called​
    13·1 answer
  • Write a function (funception) that takes in another function func_a and a number start and returns a function (func_b) that will
    7·1 answer
  • This type of software works with end users, application software, and computer hardware to handle the majority of technical deta
    12·1 answer
  • A ________ is a single media file including art, sound, animation, or movies.
    9·1 answer
  • The tremendous diversity ofthe source system is the primary reason for their complexity. Doyou agree/ If so, explain briefly why
    11·1 answer
  • Use rounding to decide if the answer is reasonable. Write
    15·1 answer
  • What is the description of ?
    13·1 answer
  • How many devices can I sign in on with my one Brainly account?
    5·2 answers
  • LANGUAGE IS PYTHON!!! PLEASE HELP
    12·1 answer
  • Which type of work would be a good candidate for improvement through automation?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!