Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a simple code, given the following instructions. Thanks!:) I have also attached pictures of the two textfiles given and a template. The program

Please write a simple code, given the following instructions. Thanks!:)

I have also attached pictures of the two textfiles given and a template.

The program will begin by prompting for the user information. Next the user is asked for the name of the users input file. The file is processed, and calculated results are displayed and also written to the default output file as shown in the sample output shown below. You have to write an algorithm to solve this project. You are required to demonstrate the use of an algorithm in completing this assignment meaning that you must include the number and short description of each step in the program documentation (comments) showing your stepwise approach to solving this problem. See tips at bottom. Example output is shown at the end of this document. Prompt the user to input the following user information, and echo the information to the screen. Full User Name - a string that may contain blanks ex: Jean Morton User Alias a string that does not contain blanks ex: potteryQueenJean User ID an integer in the range 1 thru 99999 ex: 72014 Prompt the user for the name of the file containing the list of items for auction: Open the file and process the following for each item in the file: Read the line containing the user code. The content in the code can be deciphered as follows. User FileID integer ex: 72014 User Status and Payment Code a string, whose first character represents the customer type. ex: P= premium, S= standard, U= ultra. (we will ignore the rest of this string for now) Balance Due a floating point value. ex: 38.99 if negative, its a credit Compare the five character UserID supplied by the user, to the FileID read from the input file. If they do not match, display an error message and exit the program. If they do match, continue on with the program. Examine the structure of the data by opening, and examining the content of the sample input files provided. Three new characteristics are added to our description of the auction items. Item quality, addons, and state. Read the list of items. Item_Quality integer value in range (1-100) ex: 90 Item_Addon a character value ex: F F , E , or D only. Item_State a string value ex: New or Used Name a string that may contain blanks ex: Chinese Vase with Green Elephant decor Time a string that does not contain blanks ex: 07:10:36 Price a floating point value. ex: 38.99 These three new items are describe in further detail below. Item_Quality is a whole number value representing the overall condition of the item, in the range of 1 to 100. Item_Addon is a character representing additional discounts, conditions, or actions to be taken on this item. o F is a full discount on the item. o E means that the item is exempt from all discounts o D means that the item gets a descriptive discount ( it depends on the type of customer). Item_State is a string indicating either a new New or used Used item up for auction.

Consider the following as each item is processed, before the sum or average or donation amount is calculated. Dont worry about adjusting the highest and lowest values determined, with respect to the discounts. Discounted values are not considered. No discounts or adjustments apply to a file containing one item. 1. If the item is New, and the customer is a Premium customer, and the item is not Exempt from all discounts - then the item price is reduced by PREMIUM_DISCOUNT immediately. 2. If the item condition is used, and the quality is below 50, and the item is not exempt from all discounts, or if the item condition is new, and the quality is less than or equal to 40, and the item item has a Full addOn discount status then the item price is reduced by USED_DISCOUNT. 3. If the item is new and priced above $1000, and the AddOn code is D, the and the customer is either Ultra or Premium, then the ULTRA_DISCOUNT is doubled in value and then is applied to the item, and webAddPoints is increased by the constant value of WEBADDULTRA. See the program output, and include the same information as shown for Item Statistics. If the customer has a balance due, subtract it from the total sum. If the customer has a credit, add it to the total sum. Display this as the Adjusted Sum. 4. If the customer has a credit - increase their webAddPoints by adding to it, the constant value of WEBADD. Determine and display the following information: Total Number of all items up for auction an integer value Highest and Lowest Cost found amongst these items floating point values. Average Cost of all items floating point value. (price sum / number items ) Rounded Average Cost of all items an integer value. (round average found above ) WebAddPoints floating point value(calc same as project 1) You must use the math functions pow and sqrt for the above formula. If there is only one item in the items file, then the WebAddPoints is equal to zero. Notes: 1. Remember to include programmer documentation in the source code and in the output. 2. We will test your solution with input files of the same structure. Your program should work for any input values. Graders will follow the directions in your prompts. You should test your program with different data sets (make your own input files of the same structure as of those provided). You are not allowed to change the provided input files in any way. 3. Use a separate prompt for each user input value, and echo the input back (as shown in the example output and in the executable version of the program provided). 4. Format floating point values in the output with 2 decimal places. 5. Remember to save a copy of the file you hand in. Leave the file unchanged after your submission until you receive a grade on the project assignment. Note that if you submit the wrong file as your solution, this will not earn you credit. You must submit your source code solution in the form of a file with the .cpp extension. Once the solution for a project has been released (usually coinciding with the due date), then no credit can be given or late submissions accepted under any circumstances. It is your responsibility to start early, submit your solution in plenty of time to account for errors or questions for the lab TA, and your responsibility to check and make sure that you did submit the correct file for your submission. Check the file you submitted immediately after uploading your solution to make sure that you submitted the correct file. 6. Name your source code file using your last name and first initial as follows: lastname_firstInitial_Prj1.cpp ;for example, Meg Griffin would save her source code in a file name Griffin_M_Proj1.cpp

image text in transcribed

image text in transcribed

image text in transcribed

1.00 00 07:10:26 Used 439,50 a7 51 n thing surine 4 1.00 00 07:10:26 Used 439,50 a7 51 n thing surine 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions