1. Homepage
  2. Coding
  3. CS1315 Computer Programming Assignment One - Cheapest Payment

CS1315 Computer Programming Assignment One - Cheapest Payment

Order Now
CityU Hong KongCS1315Computer ProgrammingC++

CS1315 Computer Programming Assignment One (2024-25 Sem. A) Assignment Writing Service


Problem description
Assignment Writing Service

Consider a buffet restaurant with two price settings: Adult (e.g. $200) and Child / Senior (e.g. $150). You may assume that both prices are non-negative (with the Adult price is always higher) and assume that there is no service charge. To attract more customers, the restaurant is offering two types of discounts: Assignment Writing Service

A) Buy-X-get-Y-free: Assignment Writing Service

  •   X and Y are positive integers (>=1). Assignment Writing Service

  •   Customer must pay X people in Adult price and up to Y Children / Seniors will be free. (less than Y is okay. e.g. A group of 2 Adults and 1 Child can also make use of buy-2-get-2, so 2 Adults will pay and 1 Child will be free). Assignment Writing Service

  •   Child / Senior may also pay in Adult price if needed.
    (e.g. Suppose the discount is buy-2-get-2. For a bill with 1 Adult and 3 Children, one of the Children could pay in Adult price to fulfill the X Adult requirement, then the remaining 2 Children will enjoy the Y free quotas). Assignment Writing Service

  •   Creating “ghost” customer is also okay.
    (e.g. Suppose the discount is buy-2-get-2. For a bill with 1 Adult and 2 Children, the customers could choose to pay for a non-existing adult to fulfill the X Adult requirement, so that the remaining 2 Children will be free). Assignment Writing Service

    B) D-percent-offforZormore: Assignment Writing Service

  •   Z is positive integer (>=1) and D is between 0 and 100 (inclusive). Assignment Writing Service

  •   The Z (or more) customers could be of mixed (Adult/Child) types and the D percent off will be applied to the original bill for them. Assignment Writing Service

  •   Creating “ghost” customer is also okay.
    (e.g. Suppose the discount is 50% off for 4. A table of 2 Adults and 1 Child could choose to pay for a non-existing child, so that the bill will be (2 Adults + 2 Children) * 50%)) Assignment Writing Service

The bill could be partitioned so that different customers in the bill could enjoy different discounts. However no single customer could enjoy both discounts. For instance, if the discounts are buy-1-get-1 as well as 40%-off-for-3. A group of 1 Adult and 2 Children may choose to: Assignment Writing Service

  •   Enjoy 40% off for all 3 of them, or, Assignment Writing Service

  •   Enjoy buy-1-get-1 for 1 Adult and 1 Child; paying the remaining Child normally. (i.e. 1 Adult pays, 1 Child is free and the “remaining Child” do not enjoy 40% off, as the number of “remaining” customer is 1, not 3) Assignment Writing Service

  •   Of course, they could choose to pay for a non-existing Adult to enjoy buy-1-get-1 two times... Assignment Writing Service

    However for a group of 2 Adults and 3 Children, they may choose to: Assignment Writing Service

  •   Enjoy 40% off for all 5 of them, or, Assignment Writing Service

  •   Enjoy buy-1-get-1 for 1 Adult and 1 Child; Enjoy 40% off for the remaining 1 Adult and 2 Children, or, Assignment Writing Service

  •   Enjoy buy-1-get-1 for 2 Adults and 2 Children; paying the remaining Child normally. Assignment Writing Service

  •   Of course, if they like, they can also pay for a non-existing Adult and enjoy buy-1-get-1 for a total of three times in the bill. Assignment Writing Service

    Your task is to find out the cheapest payment amount given the corresponding prices, discount settings and headcounts. The numbers are always in the valid range stated in page 1 (no checking is needed) but the numbers are not necessarily realistic (e.g. price of $0, buy-1-get-4, or 99% off could be possible). Assignment Writing Service

    Your program should output exactly in the format (spelling, spacing...etc) as shown in the next page, with the final amount shown in 3 decimal places. Assignment Writing Service

Sample Input / Output: Assignment Writing Service

Example 1: (User Input is underlined) Assignment Writing Service

Example 2: (User Input is underlined) Assignment Writing Service

Example 3: (User Input is underlined) Assignment Writing Service

Example 4: (User Input is underlined) Assignment Writing Service

Marking criteria Assignment Writing Service

Submitted program will be tested repeatedly with PASS. Marks will be graded objectively Assignment Writing Service

based on the number of correct outputs reported by PASS (no matter whether it’s the same as what you saw in your development platform or not). Assignment Writing Service

If the program is not compilable in PASS, zero mark will be given. Assignment Writing Service

Make sure that the output format (spelling, punctuations, spacing...etc) follows exactly the sample output above otherwise PASS will consider your answer incorrect. Marker will make NO manual attempt to check or re-mark program output. Assignment Writing Service

Input the Price for Adult: 250
Input the Price for Child/Senior: 150
Input the counts of Adult and Child: 2 3
Input X Y for the Buy-X-get-Y: 1 1
Input D Z for group discount: 40 3
The payment is: $570.000
Input the Price for Adult: 250
Input the Price for Child/Senior: 150
Input the counts of Adult and Child: 2 3
Input X Y for the Buy-X-get-Y: 1 1
Input D Z for group discount: 30 3
The payment is: $635.000
Input the Price for Adult: 250
Input the Price for Child/Senior: 150
Input the counts of Adult and Child: 2 3
Input X Y for the Buy-X-get-Y: 1 1
Input D Z for group discount: 10 3
The payment is: $650.000
Input the Price for Adult: 499.9
Input the Price for Child/Senior: 299.9
Input the counts of Adult and Child: 2 3
Input X Y for the Buy-X-get-Y: 3 2
Input D Z for group discount: 33.33333 3
The payment is: $1266.333

Assignment Writing Service

Unlike tutorial exercises, for assignment, PASS will NOT make ALL test cases visible. (i.e. there are hidden test cases). Queries regarding hidden test case(s) will NOT be answered. It is the responsibility of a programmer to design own test cases in order to verify the correctness of the written program. Assignment Writing Service

Note that the marking in PASS is automatic, therefore the following situations may lead to zero marks: Assignment Writing Service

Input/output does not match the requirements as defined.
(e.g. incorrect spacing, incorrect spelling, letter cases or punctuations) Assignment Writing Service

Submission of non .cpp files (e.g. .exe or .zip files)
Not uploading via “Submit” function. (Note: Upload via “Test” button will NOT be counted) Assignment Writing Service

(Students may test or submit many times, only the last “submit” will be marked) Assignment Writing Service

Please also note that the PASS plagiarism check will also be turned on. The same disciplinary action will be applied without distinguishing which one is the source / copier. Please safeguard your files if you work on your assignment using public computers (e.g. CityU Lab) Assignment Writing Service

Testing and Submission Assignment Writing Service

Students should submit cpp file to PASS before the deadline. All other submission methods (e.g. hardcopy, email...etc) will be ignored. Students may use whatever IDE/compiler for development, but program which is not compilable in PASS will lead to zero mark (e.g. program using non-standard, platform-specific features). The marker will make no attempt to fix the syntax error or make the code compilable. Assignment Writing Service

If you observe that the answer in PASS is different from the one you get in your PC, most likely it is caused by programming bugs like uninitialized variables. The result by PASS will be used for marking without consideration of what you observed in your local PC. Assignment Writing Service

Please also note that the PASS system could be extremely busy and may become sluggish in responding near deadline. You’re suggested to reserve enough time for submission (Not the usual button, but the Submit” button for assignments). Assignment Writing Service

To protect yourself, it is advised that you write down your particulars (full name, student number, eid...) in the beginning of your source code as comment Assignment Writing Service

联系辅导老师!
私密保护
WeChat 微信
CityU Hong Kong代写,CS1315代写,Computer Programming代写,C++代写,CityU Hong Kong代编,CS1315代编,Computer Programming代编,C++代编,CityU Hong Kong代考,CS1315代考,Computer Programming代考,C++代考,CityU Hong Kong代做,CS1315代做,Computer Programming代做,C++代做,CityU Hong Konghelp,CS1315help,Computer Programminghelp,C++help,CityU Hong Kong作业代写,CS1315作业代写,Computer Programming作业代写,C++作业代写,CityU Hong Kong编程代写,CS1315编程代写,Computer Programming编程代写,C++编程代写,CityU Hong Kong作业答案,CS1315作业答案,Computer Programming作业答案,C++作业答案,