Question

In: Computer Science

Needs to be in JAVA. Write a Java program that accepts the total amount of cars...

Needs to be in JAVA. Write a Java program that accepts the total amount of cars sold and total sales amount of a car salesperson for a given month.

The salesperson’s paycheck is computed as follows:

a. Every sales person gets 10% (commission) of total sales

b. Sales totals greater than $50,000 get 5% of total sales amount

c. 8 or more cars sold earns the salesperson an extra 3%

Please remove 30% (taxes) of the gross pay and list the paycheck amount.

Solutions

Expert Solution

import java.util.Scanner;

public class CarSalesPerson {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int totalCarsSold;
        double totalSales;

        System.out.print("Enter total amount of cars sold: ");
        totalCarsSold = scanner.nextInt();

        System.out.print("Enter total sales amount of a car salesperson for a month: ");
        totalSales = scanner.nextDouble();
        
        double amount = totalSales/10;
        if(totalSales > 50000){
            amount += (totalSales*(5.0/100));
        }
        if(totalCarsSold>=8){
            amount += (totalSales*(3.0/100));
        }
        
        double grossPay = amount*(30.0/100);

        System.out.println("Gross pay = "+grossPay);
        
        amount = amount - grossPay;

        System.out.println("Pay check amount = "+amount);
        
    }
}

Related Solutions

Program in Java code Write a program with total change amount in pennies as an integer...
Program in Java code Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. .Ex1: If the input is: 0 the output is:    No change            Ex2: If the input is:    45   the output is:   1 Quarter 2 Dimes
For Java 3.25 LAB: Exact change Write a program with total change amount in pennies as...
For Java 3.25 LAB: Exact change Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes...
Write one Java program and satisfy the following requirements: Write a method called cube that accepts...
Write one Java program and satisfy the following requirements: Write a method called cube that accepts one integer parameter and returns that value raised to the third power. Write a method called randomNumber that returns a random floating-point number in the range of [-20.0, 50.0). (hints: use Random class in the method) Write a method called findMax that accepts three floating-point number as parameters and returns the largest one.(hints: use conditional statement in the method) Overload findMax that accepts one...
java Problem 3: An Interesting Problem Write a program that accepts two positive integers: a deposited...
java Problem 3: An Interesting Problem Write a program that accepts two positive integers: a deposited amount of money and an interest rate, as an annual percentage rate. Your program will calculate the number of years that will take for the account balance to reach $1, 000,000. You can assume that the initial deposit is less than $1,000,000 Input The input will begin with a single line containing T , the number of test cases to follow. The remaining lines...
Write a program in Java which performs the sort operation. The main method accepts ten numbers...
Write a program in Java which performs the sort operation. The main method accepts ten numbers in an array and passes that to the method sort. The method sort accepts and sorts the numbers in ascending and descending order. The method display shows the result. You can use integers or floating point numbers.
Write a Java program for a car dealership. The dealer has 10 cars in the showroom...
Write a Java program for a car dealership. The dealer has 10 cars in the showroom and space for 50 cars. Each car has a unique plate number, model, color, company, and a year of manufacture. Your program should have two classes: the "Car" class has the car information and the "info" method that displays the car information. The other class is an array class "CarArray" that has four methods:" display", "insert", "find", and the "delete" method. When the program...
Needs to be in basic JAVA Write a program that does basic encrypting of text. You...
Needs to be in basic JAVA Write a program that does basic encrypting of text. You will ask the user the filename of a text file that contains a few sentences of text. You will read this text file one character at a time, and change each letter to another one and write out to an output file. The conversion should be done a -> b, b->c , … z->a, A->B, B->C, …. Z->A. This means just shift each letter...
Your task is to write a program in C or C++ that calculates the total amount...
Your task is to write a program in C or C++ that calculates the total amount of money a person has made over the last year. Your program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based...
In the space provided below write a C ++ program that computes the total amount of...
In the space provided below write a C ++ program that computes the total amount of money you are depositing in your bank account. Your program does this by asking you to first enter the number and amount of each check you are depositing, and then it asks you to enter the type of cash bills being deposited and how many of each type, also the types of coins being deposited, and the number of each coin type.
Write a program in pyton with total change amount as an integer input, and output the...
Write a program in pyton with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes Can you...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT