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
Strike441 [17]
3 years ago
9

For this lab, you will write a Java program to prompt the user to enter two integers. Your program will display a series of arit

hmetic operations using those two integers. Create a new Java program named Project01.java for this problem.
Sample Output: This is a sample transcript of what your program should do. Items in bold are user input and should not be put on the screen by your program. Make sure your output looks EXACTLY like the output below, including spacing. Items in bold are elements input by the user, not hard-coded into the program.
Enter the first number: 12
Enter the second number: 3
12 + 3 = 15
12 - 3 = 9
12 * 3 = 36
12 / 3 = 4
12 % 3 = 0
The average of your two numbers is: 7
A second run of your program with different inputs might look like this:
Enter the first number: -4
Enter the second number: 3
-4 + 3 = -1
-4 - 3 = -7
-4 * 3 = -12
-4 / 3 = -1
-4 % 3 = -1
The average of your two numbers is: 0
HINT: You can start by retyping the code that was given to you in Exercise 3 of ClosedLab01. That code takes in a single number and performs a few arithmetic operations on it. How can you modify that code to take in two numbers? How can you modify it to display "number * number =" instead of "Your number squared is: "? Take it step by step and change one thing at a time.
You can use the following as a template to get you started. Note that you must create your class in the default package and your project must be named Project01.java for the autograder to be able to test it when you submit it.
Computers and Technology
1 answer:
Mekhanik [1.2K]3 years ago
7 0

Answer:

Following are the program to this question:

import java.util.*;//for user-input value  

public class Project01//Decalring a class Project01

{

public static void main(String asq[])//main method  

{

int ax1,ax2;//Decalring integer variables

Scanner oscr=new Scanner(System.in);//creating Scanner class Object

System.out.print("Enter the First number: ");//print message  

ax1=oscr.nextInt();//input first number

System.out.print("Enter the Second number: ");//print message

ax2=oscr.nextInt();//input second number

System.out.println(ax1+ "+"+ax2+"= "+(ax1+ax2));//use print method to perform the arithmetic operation  

System.out.println(ax1+"-"+ax2+"= "+(ax1-ax2));//use print method to perform the arithmetic operation

System.out.println(ax1+"*"+ax2+"= "+(ax1*ax2));//use print method to perform the arithmetic operation

System.out.println(ax1+"/"+ax2+"= "+(ax1/ax2));///use print method to perform the arithmetic operation

System.out.println(ax1+"%"+ax2+"= "+(ax1%ax2));//use print method to perform the arithmetic operation

System.out.println("The average of your two numbers is: "+(ax1+ax2)/2);//calculating average

}

}

Output:

Please find the attached file.

Explanation:

In the program, inside the class "Project01" and the main method two integer variable "ax1,ax2" is declared that uses the scanner class concept for input the value from the user-end, and in the next step, it uses the print method with the arithmetic operation to perform and prints its calculated value.

You might be interested in
What is the fifth-generation wireless broadband technology based on the 802.11ac standard engineered to greatly increase the spe
kirza4 [7]

Answer:

The fifth-generation wireless broadband technology based on the 802.11ac standard is called the

5G.

Explanation:

The 5G is the newest baby in town in the area of wireless broadband technology.  The technology is based on the IEEE 802.11ac standard. 5G operates with a 5Ghz signal and is set to offer out-of-this-world speeds of up to 1 Gb/s.  This implies massive connectivity for everyone and everything.  However, its trial has been fraught with many challenges.  Questions have been raised, especially relating to some health concerns about the technology.  However, many advantages have been ascribed to this wireless technology.  They include more reliability, massive network capacity, increased availability, more uniform user experience, higher performance. and improved efficiency.

4 0
3 years ago
What is computer virus​
IRINA_888 [86]

Answer:

A type of malicious code or program written to alter the way a computer operates and is designed to spread from one computer to another.

Once a virus has successfully attached to a program, file, or document, the virus will lie dormant until circumstances cause the computer or device to execute its code. In order for a virus to infect your computer, you have to run the infected program, which in turn causes the virus code to be executed.

8 0
3 years ago
Read 2 more answers
Write a program that asks the user for three strings. Then, print out whether the first string concatenated to the second string
ipn [44]

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter The First String");

       String str1 = in.next();

       System.out.println("Enter The Second String");

       String str2 = in.next();

       System.out.println("Enter The Third String");

       String str3 = in.next();

       String oneAndTwo = str1+str2;

       if(str3.equals(oneAndTwo)){

           System.out.println(str1+" + "+str2+" is equal to "+str3+"!");

       }

       else

           System.out.println(str1+" + "+str2+" is not equal to "+str3+"!");

   }

}

Explanation:

  • Implemented in Using Java Programming Language
  • Import Scanner Class to prompt and receive users' input
  • Create three string variables and store the three values entered by the user (str1, str2 and str3)
  • Concatenate str1 and str2 using the + operator and assign to a new variable
  • Use the if statement with Java's .equals() method to check for equality of the new string with the third string
  • Print the appropriate message if the equal or not
8 0
3 years ago
P36. In Section 3.5.4, we saw that TCP waits until it has received three duplicate ACKs before performing a fast retransmit. Why
KatRina [158]

Answer:

The Packets can be arrived out of an order from the Internet Protocol layer.  

So, whenever the out of an order packets would be received then, it would be generated the duplicate ACK's, if we perform the re-transmission after the first duplicate ACK would be lead the senders to introduced too many redundant packets in the networks.

Explanation:

  • All the bytes, in the Transmission Control Protocol connections, are the numbered, from the beginning at the randomly choose the initial sequence number (ISN).  
  • The SYN packets consumes the one sequence number, so the data will be actual and it begins at the ISN+1.  
  • The receivers ack's sequences the number x acknowledged the receipts of all the data bytes that is less than byte the number x.
7 0
3 years ago
Most game development is done with object-oriented programming languages
kari74 [83]

I think its b, but not so sure

dont sue me if im wrong please

7 0
3 years ago
Read 2 more answers
Other questions:
  • What does a first line indent look like
    13·1 answer
  • You can change the location of the layers panel on the screen by _____ .
    7·1 answer
  • ____ is a practice where a user in enticed by possible rewards and then asked to provide personal information.
    14·1 answer
  • Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than
    14·1 answer
  • What type of power flaw involves a fluctuation in voltage levels caused by other devices on the network or by EMI?
    13·1 answer
  • What are techniques for active listening? Select all
    10·1 answer
  • If user reading a document on computer, it allows you to navigate on any part of the document called?
    5·1 answer
  • I’ll mark brainliest if correct
    10·1 answer
  • In addition to assessing whether each of your independent variables has an effect on the dependent variable, a factorial ANOVA a
    9·1 answer
  • Your child has broken the RJ-45 port of your laptop by sticking clay into it and there are no wireless networks available in you
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!