Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. 5. Using the example output as a guide, declare the necessary fifteen (15) variables used to represent the three (3) product data records. Note

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

. 5. Using the example output as a guide, declare the necessary fifteen (15) variables used to represent the three (3) product data "records". Note You must select the appropriate data type for each variable based on the type of data that needs to be store You must use self-describing variable names to maximize readability and maintainability of the code 6. Prompting user-input for a single character value can cause unexpected behaviour which you will learn about late in the semester, however, for now use the following scanf formatting specifier (between the double-quotes) to avoid strange behaviour (notably the single-space before the percent sign): scanf("%c", ... 7. Displaying the product data in a tabular format requires the application of some slightly more advanced formatting features (you will learn more about this later in the semester). For now, you can use the first product data line below to get you going (copy/paste into your code): printf("11 %d TXd d Xd | 1% | 4d 46.316 | | *5.11f | *5.11f ", ... Xd 1 * 8. The below table provides the mapping rules you must apply in matching the user input preferences to each produc (Example: if the user prefers "Mild" coffee, and the product type is "Light" this would show as true (non-zero) in the summary table result): Preference Product Coffee Strength Mild Rich Coffee Making Equipment Residential Commercial Daily Servings inclusive range) 1 to 4 5 to 9 10 or more Like Cream with Coffee Coffee Type Light Blend Coffee Grind Size Course Fine Coffee Package Weight (inclusive range) O to 250 g 500 g 1000 Yes No Suggest Serving with Cream Yes No Coffee Making Equipment Residential Commercial Serving Temperature (cluster 60.0 to 69.9 ("C) 70.0 or more ("C) 9. You should not need to declare more than four (4) additional variables to store the user-input values that describe a scenario of the user's preferences and equipment used in making coffee. The variables will be used in determining how each product "matches the needs based on the input scenario (see above table). Reminder All variable declarations MUST be grouped together at the beginning of the "main" function to maximize the management of your program variables (will be easy to find being all in one place) 1. Upload file transfer) your source file "w2p1.c" to your matrix account 2. Login to matrix in an SSH terminal and change directory to where you placed your workshop source code 3. Manually compile and run your program to make sure everything works properly: gcc -Wall w2p1.0 -0 W2 if there are no errors/warnings generated, execute it: W2 4. Run the submission command below (replace profname.proflastname with your professors Seneca useric replace NAA with your section): -profName.proflastname/submit 1442/NAA_p1 5. Follow the on-screen submission instructions Part-2 (40%) Instructions 1. Carefully review the "Part-2 Output Example" (next section) to see how this program is expected to work 2. Code your solution to Part-2 in the provided "w2p2.c" source code file 3. This program can be broken down into a few major logical code sections: a) Variable declarations: All variables should be declared together into meaningful groups at the top of the mai function b) Product data input: Prompt for data describing three (3) products and store user-input to appropriate variabl c) Display product data: Summarize the product data in a tabular format to help make the data easy to read d) User preference input (scenario 1 of 2): Prompt for the user's coffee preferences and store user-inputs to appropriate variables e) Display summary of results: Applying the user-input preferences, determine how each product matches the needs of the user defined preferences f) Repeat: Repeat step (d) and (e) for another preference scenario 4. Don't delete or modify the provided "GRAMS_IN_LBS" variable declaration (you will need this in the conversion from grams to pounds when appropriate). Mac esc 101 # ! 1 2 $ 4. % 5 3 Q W E R tab A s c n 10. Displaying the preference to product summary results in a tabular format requires the application of some slightly more advanced formatting features you will learn more about this later in the semester). For now, you can use the first product data line below to get you going (copy/paste into your code): printf(" 11 Xd %d 1 Xd 1 Xd ", ... , Note You must code the required relational and/or logical expression(s) using the appropriate variables as required for each mapped field which will provide the true/false result using the matching rules table described earlier. Part-2 Output Example (Note: Use the YELLOW highlighted user-input data for submission) Take a Break - Coffee Shop 3D%3D%3D%3D%3D EEEEEEEEEEEEEEEE Enter the coffee product information being sold today... COFFEE-1... Type ([L]ight, [B]lend): 1 Grind size ([C]ourse, [F]ine): C Bag weight (g): 250 Best served with cream ([Y]es, [N]o): y Ideal serving temperature (Celsius): 65.7 COFFEE-2... Type ([Llight, [B]lend): B Grind size ([C]ourse, [F]ine): F Bag weight (g): 500 Best served with cream ([Y]es, [N]o): N Ideal serving temperature (Celsius): 70.0 COFFEE-3... Type ([L]ight, [B]lend): L Grind size ([C]ourse, [F]ine): f Bag weight (g): 1000 Best served with cream ([Y]es, [N]o): n Ideal serving temperature (Celsius): 80.5 Coffee Coffee Packaged Best Serving 1 Type Grind Size Bag Weight | Served Temperature + With ID Light Blend | Course Fine (G) | Lbs | Cream (C) | (F) 1 1 1 1250 0.551 1 165.7 | 150.3 21 0 1 1 0 I 1 1 500 500 1.102 70.0 158.0 31 1 1 0 1 1000 | 2.205 0 180.5 | 176.9 Enter how you like your coffee and the coffee maker equipment you use... Coffee strength ([M]ild, [R]ich): m Do you like your coffee with cream ([Y]es, [N]O): y Mace esc Typical number of daily servings: 6 Maker ([R]esidential,[C]ommercial): C The below table shows how your preferences align to the available products: ID Coffee Type Coffee Grind Size Packaged Bag Weight With Cream Serving Temperature 1 11 21 31 0 1 1 0 1 0 1 0 0 0 1 1 1 1 Enter how you like your coffee and the coffee maker equipment you use... Coffee strength ([M]ild, [R]ich): R Do you like your coffee with cream ([Y]es, [N]o): N Typical number of daily servings: 10 Maker ([R]esident 1,[C]ommercial): R The below table shows how your preferences align to the available products: Coffee Type ID Coffee Grind Size Packaged Bag Weight With Cream Serving Temperature 0 1 21 31 0 1 0 1 0 0 0 0 1 1 1 1 0 0 Hope you found a product that suits your likes

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

Mastering Influxdb Database A Comprehensive Guide To Learn Influxdb Database

Authors: Cybellium Ltd ,Kris Hermans

1st Edition

B0CNGGWL7B, 979-8867766450

Students also viewed these Databases questions

Question

What is a budget decrement?

Answered: 1 week ago