Java technical support calculates total consumption

Source: Internet
Author: User

[Java]
/*
* Start the program header annotation.
* Copyright and version Declaration of the program
* Copyright (c) 2011, a student from the computer College of Yantai University
* All rights reserved.
* File name: calculates the total consumption.
* Author: Xue Guangchen
* Completion date: January 1, September 15, 2011
* Version No.: x1.0

* Description of tasks and Solutions
* Input description:
* Problem description: John wants to buy a T-shirt. The unit price and quantity of the T-shirt are entered by the user,
Li Si wants to purchase tennis balls. The unit price and quantity of tennis balls are input by users;
Calculate and output the total consumption of John and James respectively.
 

* Program output:
* End the comment in the program Header
*/
 
 
Package xue.com;
 
Public class Amount {
 
/**
* @ Param args
*/
Public static void main (String [] args ){
// TODO Auto-generated method stub
System. out. println ("Enter the number of three t-shirts purchased :");
Int number1 = Console. readInt ();
System. out. println ("Enter the unit price of a three-member T-shirt :");
Double price1 = Console. readDouble ();

System. out. println ("Enter the number of tennis balls purchased by Li Si :");
Int number2 = Console. readInt ();
System. out. println ("Enter the unit price of the tennis balls purchased by Li Si :");
Double price2 = Console. readDouble ();

System. out. println ("customer consumption amount ");
System. out. println ("James" + number1 * price1 );
System. out. println ("Li Si" + number2 * price2 );

}
 
}
 
Running result:
Enter the number of T-shirts purchased by Michael JACOB:
10
Enter the unit price of the three-person T-shirt:
20
Enter the number of tennis balls purchased by Li Si:
30
Enter the unit price of the tennis balls purchased by Li Si:
5
Customer consumption amount
Zhang San 200.0
Li Si 150.0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.