Question

Please create a Java Program, Using Netbeans JDK, that Asks the operator for 2 numbers, and...

Please create a Java Program, Using Netbeans JDK, that Asks the operator for 2 numbers, and the user's First and Last Name, and calculates the sum, difference, quotient, and product of the 2 numbers. The program should display to screen:

"Hello ";{First Name Last Name}
"The Sum is ": {Sum}
"The Difference is ": {Difference}
"The Product is: ": {Product}
"The Quotient is ": {Quotient}

Each student should post a Java program should have: (a) Pseudocode and (b) adjacent Java code. (*Note: Pseudocode must be placed in comments)

//Pseudocode

Java Code

//Pseudocode2

Java Code 2

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question.

Here is the completed code for this problem. Comments are included so that you understand whats going on. Let me know if you have any doubts or if you need anything to change.

Thank You !!

==================================================================================================

import java.util.Scanner;

public class FE1 {

    // create a Scanner object to take user inputs
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {

        // takes all 4 input from user
        System.out.print("Enter first name: "); // print message to user for entering first name
        String firstName = scanner.nextLine();
        System.out.print("Enter last name: "); // print message to user for entering last name
        String lastName = scanner.nextLine();
        System.out.print("Enter first number: "); // print message to user for entering first number
        double firstNumber = scanner.nextDouble(); // storing the number as double
        System.out.print("Enter second number: "); // print message to user for entering second number
        double secondNumber = scanner.nextDouble(); // storing the number as double

        // print the results
        System.out.println("Hello: " + firstName + " " + lastName);
        System.out.println("The Sum is: " + (firstNumber + secondNumber)); // sum the two numbers
        System.out.println("The Difference is: " + Math.abs(firstNumber - secondNumber)); // difference the two numbers
        System.out.println("The Product is: " + (firstNumber * secondNumber)); //// multiply the two numbers
        if (secondNumber != 0) // check if the denominator is not zero
            System.out.println("The Quotient is: " + (firstNumber / secondNumber));
        else // if denominator is zero print message
            System.out.println("The Quotient is: undefined");

    }

}

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

FE1.java x /create a Scanner object to take user inputs private static Scanner scanner = new Scanner (System.in); 7 public st

Add a comment
Know the answer?
Add Answer to:
Please create a Java Program, Using Netbeans JDK, that Asks the operator for 2 numbers, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a java program that asks the user to enter 2 integers, obtains them from the...

    Write a java program that asks the user to enter 2 integers, obtains them from the user, determines if they are even or odd numbers and prints their sum, product, difference, and quotient (Division).

  • In Java (Netbeans), Create a program to Generate Fibonacci numbers using variable length arrays and display...

    In Java (Netbeans), Create a program to Generate Fibonacci numbers using variable length arrays and display them separated with tabs.

  • Write a C program that asks the user to enter two real numbers. Then your program...

    Write a C program that asks the user to enter two real numbers. Then your program displays a menu that asks the user to choose what arithmetic operation to be done on those numbers. Depending on the user's entry, the program should display the result to the screen. The sample runs below show what should be done to the numbers entered by the user. Your program should run exactly like shown in the sample runs. make your code run as...

  • java Part 1 Create a NetBeans project that asks for a file name. The file should...

    java Part 1 Create a NetBeans project that asks for a file name. The file should contain an unknown quantity of double numeric values with each number on its own line. There should be no empty lines. Open the file and read the numbers. Print the sum, average, and the count of the numbers. Be sure to label the outputs very clearly. Read the file values as Strings and use Double.parseDouble() to convert them. Part 2 Create a NetBeans project...

  • Using C++ Reference Parameters Assignment Write a program that asks the user for 3 numbers, sends...

    Using C++ Reference Parameters Assignment Write a program that asks the user for 3 numbers, sends the numbers to a function that calculates the sum and product and returns the sum and product to the main function. In the main function, use a cout statement to display the sum and product. * You are returning the multiple values sum and product.

  • Design a program that asks the user to enter a series of 20 numbers. The program...

    Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in the array and then display the following data: The lowest number in the array The highest number in the array The total of the number in the array The average of the numbers in the array PLEASE GIVE THE PSEUDOCODE AND CODE IN C PROGRAMMING

  • In java, write a program that gets 10 integer numbers from the user using user input,...

    In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read.   Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. version1:  use a while loop. version2:  use a do-while loop. version 3:  use a for loop. For each version, use a loop to input 10 int numbers from the user...

  • In Java, write a program that asks the user for the name of a file. The...

    In Java, write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage

  • Create a program that asks that asks the user for the number of males and females...

    Create a program that asks that asks the user for the number of males and females in a class. The program should display a percentage of males and females. For example, there are 5 males, and 15 females. That makes 20 people total. To find the percentage of males you can divide 5 by 20, which makes 0.25, or 25% HINT: USE A VARIABLE for every group of people that you will use in your calculation. Submit your .java source...

  • Write a Java program that: • Asks the user to enter the number of integers that...

    Write a Java program that: • Asks the user to enter the number of integers that he need to enter; • Asked him to enter integer by integer; • Print The number of Odd numbers entered and the number of Even numbers entered. Important notes: 1. You should have to copy and paste the Java as your answer for this question. DON’T take screen shot for your Java Code. It must be editable. 2. Take a screen shot for your...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT