Job (s)

com.ZuoYe Package; 
Import Classes in java.util *; import Scanner // class. 
public class LianXi1 { 
    public static void main (String [] args) { 
        System.out.println ( "Please enter the basic wage:");   
        Scanner INPUT = new Scanner (System.in); // create Scanner objects 
        int Money; 
        Money = input.nextInt (); // get the keyboard data, and assigned to the variable Money 
        System.out.println ( "the wages broken down as:" ); 
        System.out.println ( "basic wage is:" + Money); 
        Double wuJia Money * = 0.4; 
        System.out.println ( "dearness allowance:" + wuJia); 
        Double fangZu Money * = 0.25; 
        System.out .println ( "rent allowance:" + fangZu); 
        System.out.println ( "staff salaries are:" + (+ Money + wuJia fangZu)); 
    } 
}
Copy the code

The output is:

The subject method requires the use of console receive keyboard input variable values, and need to understand the use of the basic data types like int and double;

 

2, a five-digit number using the keyboard output, and calculates the number of five values ​​you sum;

Write code as follows:

Copy the code
/ ** 
 * December 21, 2018 


 * use the keyboard to enter a five-digit, and the number of and seek you; 
 * / 
Package Penalty for com.ZuoYe; 
Import Classes in java.util *;. // import class Scanner 
public class LianXi2 { 
    static void main public (String [] args) { 
        Scanner Scanner new new iNPUT = (the System.in); // Create Object Scanner 
        System.out.println ( "Please use the keyboard to enter five digits:"); 
        int = NO iNPUT. nextInt (); // get the data keyboard input, and assigned to the variable NO 
        int wanwei = NO / 10000; 
        int & PHARMACY = NO / 1000 10%; 
        int Baiwei = NO / 100% 10; 
        int Shiwei = NO / 10 10% ; 
        int gewei NO = 10%; 
        System.out.println ( "most significant digit of the number five are:" + wanwei + "; \ t \ t the thousand is:" + qianwei + "; \ t is the hundreds digit : "+ baiwei +"; \ t ten digits is: "+ shiwei +"; \ t single digits is: "+ gewei);
        + SUM = & PHARMACY wanwei int Baiwei + + + Shiwei gewei; 
        System.out.println ( "Five-digit number in the sum of respective digits:" SUM +); 
    } 
}
Copy the code

 

The output is:

Guess you like

Origin www.cnblogs.com/zdxzdx/p/11313050.html