Cashier collection procedure, cashier collection

Source: Internet
Author: User

Cashier collection procedure, cashier collection

Subject requirements:

"" To write a cashier counter collection process.
"Requirements: receive the unit price, purchase quantity, and payment amount of the product entered by the user
"Calculates and outputs the commodity amount after off and the value of 0

 

Program Implementation

 1 package cn.fury.test; 2  3 import java.util.Scanner; 4  5 public class Test{ 6     public static void main(String[] args) { 7         Scanner sc = new Scanner(System.in); 8         System.out.println("Please input the quantity of your goods:"); 9         int quantity = sc.nextInt();10         System.out.println("Please input the price of your goods:");11         float price = sc.nextFloat();12         System.out.println("Please input the payment amount:");13         float payment_amount = sc.nextFloat();14         System.out.println("The money that you should pay is :" + price * quantity);15         System.out.println("The money that the salesclerk should return you: " + (payment_amount - price * quantity));16     }17 }
View Code

Program Improvement Plan:

"The cashier can input multiple items. when entering the end, the input is ended.

"", Enter the price of each item in sequence, and the prompt is displayed before entering

"Calculates the total amount of all commodities

"" Determines the discount based on the total amount, no discount for less than 100, if more than 100, a 200 discount, more than 300

"Returns the total amount after the discount and the amount to be changed to zero

"Notice: Waiting for optimization ......

 

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.