Question

Convert the following pseudocode to Java code. Be sure to declare the appropriate variables: store 2000.50...

Convert the following pseudocode to Java code. Be sure to declare the appropriate variables:

store 2000.50 in expenses variable

store 10000.0 in revenue variable

subtract expenses from revenue and

store the result in netIncome variable.

Display the results

Homework Answers

Answer #1
//TestCode.java
public class TestCode {
    public static void main(String[] args) {
        // store 2000.50 in expenses variable
        double expenses = 2000.50;

        // store 10000.0 in revenue variable
        double revenue = 10000.0;

        // subtract expenses from revenue and
        // store the result in netIncome variable.
        double netIncome = revenue - expenses;

        // Display the results
        System.out.println(netIncome);
    }
}

Know the answer?
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
Similar Questions
Convert these statements into Java code Store 119.5 in a variable named weight. Store 3 in...
Convert these statements into Java code Store 119.5 in a variable named weight. Store 3 in a variable factor. Divide weight by factor and store in variable ans. Display the contents of the ans variable.
Complete a pseudocode for the following program specifications. Be sure to declare the constants to be...
Complete a pseudocode for the following program specifications. Be sure to declare the constants to be used in the pseudocode. each pseudocode contains only one if statement (if-else) 2. You need a program that will calculate the electric bill for the month. Input will consist of customer name, old meter reading, and new meter reading. The output is to consist of the customer name, old meter reading, new meter reading, the kilowatt used, and the total bill. The company charges...
Design a module named multiplication, which uses parameter variables to accept two Real arguments. The module...
Design a module named multiplication, which uses parameter variables to accept two Real arguments. The module will perform multiply the two parameters and then store the result in a local variable result; then it will pass the result to a module displayResults to display the result on screen. The displayResults module is already developed by your team. Module displayResults(Real tobePrinted) Display “The final result is: “, tobePrinted End Module This shouldn't be in Java or any other programming language. I...
Write a C++ program to do the following: Declare and assign values to int variables x,...
Write a C++ program to do the following: Declare and assign values to int variables x, y Declare an int variable z; and store the sum of x and y in it Declare a pointer called pz and point it in the heap direction (using new) Store the z value in the heap location using the pz pointer Print the content of the pz pointer Print the pointer (the address)
I need the java code for a 4-function calculator app on android studio. Please make sure...
I need the java code for a 4-function calculator app on android studio. Please make sure all the requirements shown below are followed (such as the error portion and etc). The topic of this app is to simply create a 4 function calculator which calculates math expressions (add, subtract, multiply, and divide numbers). The requirements are the following : - The only buttons needed are 0-9, *, /, +, -, a clear, and enter button - Implement the onclicklistener on...
Code in Java Create a queue class to store integers and implement following methods: 1) void...
Code in Java Create a queue class to store integers and implement following methods: 1) void enqueue(int num): This method will add an integer to the queue (end of the queue). 2) int dequeue(): This method will return the first item in the queue (First In First Out). 3) void display(): This method will display all items in the queue (First item will be displayed first). 4) Boolean isEmpty(): This method will check the queue and if it is empty,...
Convert the following code using variables rather than signals. Comment on the differences of a code...
Convert the following code using variables rather than signals. Comment on the differences of a code that uses only signals to a code which makes use of variables. entity converter is port( sign_mag : in std_logic_vector(3 downto 0) ; twos_comp : out std_logic_vector(3 downto 0) ); end converter; architecture converter_arch of converter is signal neg : std_logic_vector(3 downto 0); begin process(sign_mag) begin if (sign_mag <= 1000) then twos_comp<=sign_mag; else neg <=('1' & not sign_mag(2 downto 0))+1; twos_comp<=neg; end if;
4) Create the following in a Java program. Create a Scanner Prompt the user to Receive...
4) Create the following in a Java program. Create a Scanner Prompt the user to Receive the amount and declare the variable double amount for scanner Declare variable integer remaining amount which is equal to (int) (amount*100) Find the number of one dollars bt declaring the integer variable which is equal to remaining amount divided by 100 Declare: remaining amount %=100 Find the number of quarters: Declare integer variable number of quarters equal to remaining amount divided by 25 Declare:...
in assemby, please share code and output - thanks 1. First clear all your general purpose...
in assemby, please share code and output - thanks 1. First clear all your general purpose registers by moving the value “0” into them. Initialize a variable for a BYTE, WORD, DWORD storage size each with any desired value in the data segment. Initialize another variable called Result with the size of a DWORD and make the value as an uninitialized value. In the code segment, create a label called L1 that moves the variables in the appropriate sized register...
Write a program to do the following. JAVA CODE • Input an integer n. • Create...
Write a program to do the following. JAVA CODE • Input an integer n. • Create a BinarySearchTree S inserting the keys 1, 2, . . . , n in that order, which will result in a completely-skewed tree. • Measure the time to search for n + 1 in S. 4 • Display the time taken for search.