清君
Lv 5
清君 發問時間: 電腦與網際網路程式設計 · 1 0 年前

特急特急解決java問題…

1.A large company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gorss sales for that week.

For example, a salesperson who sells $5000 worth of merchandise in a week receives $200 plus 9% of $5000, or a total of $650. You have been supplied with a list of the items sold by each salesperson. The values of these items are as follows:

Item Value

1 239.99

2 129.75

3 99.95

4 350.89

Develop a Java application that inputs one salesperson's items sold for last week and calculates and displays that salesperson's earnings. There is no limit to the number of items that can be sold by a salesperson.

2.Develop a Java application that will determine the gross pay for each of three employees. The company pays straight time for the first 40 hours worked by each employee and time and a half for all hours worked in excess of 40 hours. You are given a list of the employees of the company, the number of hours each employee worked last week and the hourly rate of each employee. Your program should input this information for each employee and should edtermine and display the employee's gross pay. Use class Scanner to input the data.

請會java的大大幫忙一下吧…很特急謝謝

1 個解答

評分
  • steven
    Lv 4
    1 0 年前
    最佳解答

    第一題

    import java.util.Scanner;

    public class sales {

    public static void main(String[] args)

    {

    Scanner a = new Scanner (System.in);

    System.out.println("how many item 1 are sold");

    int item1 = a.nextInt();

    System.out.println("how many item 2 are sold");

    int item2 = a.nextInt();

    System.out.println("how many item 3 are sold");

    int item3 = a.nextInt();

    System.out.println("how many item 4 are sold");

    int item4 = a.nextInt();

    double total = 200 item1*239.99 item2*129.27 item3*99.95 item4*350.89 ;

    System.out.println("payment:" total);

    }

    }

    第二題

    import java.util.Scanner;

    public class payment {

    public static void main(String[] args) {

    Scanner s = new Scanner(System.in);

    System.out.println("enter the name of employee");

    String name = s.nextLine();

    System.out.println("enter the hourly rate");

    double rate = s.nextDouble();

    System.out.println("enter the number of hour employee worked");

    double hour = s.nextDouble();

    double total;

    if(hour>40)

    {

    total=(hour-40)*rate*1.5+ 40*rate;

    }

    else

    total=hour*rate;

    System.out.println("Name: " name "\n" "total payment: " total);

    }

    }

    2007-04-29 11:04:57 補充:

    不好意思第一題改一下

    import java.util.Scanner;

    public class sales {

    public static void main(String[] args)

    {

    Scanner a = new Scanner (System.in);

    System.out.println("how many item 1 are sold");

    int item1 = a.nextInt();

    System.out.println("how many item 2 are sold");

    int item2 = a.nextInt();

    2007-04-29 11:05:16 補充:

    System.out.println("how many item 3 are sold");

    int item3 = a.nextInt();

    System.out.println("how many item 4 are sold");

    int item4 = a.nextInt();

    double total = 200+(item1*239.99 + item2*129.27 + item3*99.95 + item4*350.89)*0.09 ;

    System.out.println("payment:"+total);

    }

    }

還有問題?馬上發問,尋求解答。