Submit | All submissions | Best solutions | Back to list |
PCC15D - GST Calculator |
Maslee is a student at a public university. Since the implementation of Good and Services Tax (GST), the prices for food at cafeterias in the university have become more expensive and Maslee has decided to cook his own meal.
GST rates are classified into two types, which are:
- Standard-Rated (SR) Standard-rated supplies are taxable supplies of goods and services which are subject to a proposed rate of 6%.
- Zero-Rated (ZR) Zero-rated supplies are taxable supplies of goods and services which are subject to GST at 0% rate.
Below is an example of a receipt after GST:
Item | Quantity | Price | GST Rates |
---|---|---|---|
Meksis Prepaid | 1 | 30.00 | SR |
Jati Rice | 1 | 32.00 | ZR |
Rybena Juice | 2 | 18.00 | SR |
Peanut Butter | 5 | 4.50 | SR |
Total Amount Including GST | 125.81 | ||
Total Amount GST Paid | 5.31 |
And this is how to calculate the new prices for goods and services after GST:
Meksis Prepaid 1 x RM30.00 = RM30.00 + 6% = RM31.80 Jati Rice 1 x RM32.00 = RM32.00 + 0% = RM32.00 Rybena Juice 2 x RM18.00 = RM36.00 + 6% = RM38.16 Peanut Butter 5 x RM4.50 = RM22.50 + 6% = RM23.85 ---------------------------------------------------- + Total Including GST = RM125.81
Your task is to make a simple calculator to help Maslee to calculate the total amount that Maslee needs to pay for items and services after GST and the amount of GST paid for the items and services.
Input
Input consists of integer T denoting number of test cases. Each test case consists of integer N denoting number of items followed by N-lines of item details (name, quantity, price, and GST-rate). Item name will consists of single string, and price are rounded to 2 decimal places.
Output
For each test case, output consists of case number followed by 2 lines of total paid amount including GST and total amount of GST paid.
Example
Input: 2 4 MeksisPrepaid 1 30.00 SR JatiRice 1 32.00 ZR RybenaJuice 2 18.00 SR PeanutButter 5 4.50 SR 3 GardenihaBread 3 2.40 ZR WaterSpinach 5 1.10 ZR iPong6 1 2779.00 SR Output: Case #1: Total Amount Include GST: 125.81 Total Amount GST Paid: 5.31 Case #2: Total Amount Include GST: 2958.44 Total Amount GST Paid: 166.74
Added by: | fifteen |
Date: | 2016-05-09 |
Time limit: | 10s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP14 JAVA |
Resource: | PCComp2015 |
hide comments
|
|||||
2016-06-07 07:49:41
Use setprecision() |
|||||
2016-05-12 14:04:36
Getting wrong answer here. In my machine it works correctly for the given cases.. |