Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have the answer for part one, please answer part 2 and reflection ' IU USL'lIUE LU VUUl IIISLIUCLUI Wlldl VUU lliil'lftl Idlllu Ill UUlllplBllllg

i have the answer for part one, please answer part 2 and reflection

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
' IU USL'lIUE LU VUUl IIISLIUCLUI Wlldl VUU lliil'lftl Idlllu Ill UUlllplBllllg Ll'IIS wornsnop Part1 10% Instructions Download or clone workshop 6 {W506} from https:gfgithub.comeeneca-144100flPCWorkshops Note: If you use the download option, make sure you EXTRACT the les from the .zip archive file 6. Carefully review the "Part1 Output Example\" [next section} to see how this program is expected to work Code your solution to Part1 in the provided "w6p1.c\" source code file. Begin by prompting the user for their NET monthly income . The monthly income must be at least $500.00, and not more than $400,000.00 . The minimum and maximum values should be stored in unmodiable variables and used in the validation logic accordingly 0 Display an appropriate error message if the entered value is outside this range I Validation must be nested in an iteration construct and m until a valid value is entered Next, prompt the user to specify the number of wish list items they want to use in the forecast Note I The maximum number of items should be limited to 10 ldefine a macro to help with this) I Display an appropriate error message if the entered value is outside this range I Validation must be nested in an iteration construct and EM until a valid value is entered Now you are ready to store the wish list item details. Use an iteration construct to Iterate the number of times necessary to obtain the number of wish list item details specified by the user [from step #5) The item details are madeup of three [3] related pieces of information and must be stored in matching [parallel] arrays: 3} M A double oating-point value representing the value of the item The entered value must be at least 5100.00 [use an unmodiable variable to help with the validation logic accordingly] Display an appropriate error message if the entered value is invalid Validation must be nested in an iteration construct repeating until a valid value is entered lo} Priority An integer value representing the priority of the item The entered value must be between 1 and 3 inclusive where: o 1 = a must-have item Reflection 150%: Instructions Record your answer{s] to the reection question {s} in the provided \"reflecttxt\" text file Parallel arrays provide us the ability to group related data. Using what you coded in this workshop, briefly explain how you linked related data for any given item in the dataset? What was the 'key' used to accomplish this? Why do you think it is com mon practice to iterate arrays initializing the iterator variable to zero and not to a value of one? Justify your answer using an example from this workshop. How would you describe conceptually what an array is to a child [5&yearold]? How would you describe accessing an element in the array? Warning: keep your explanation simple orthe child will not understand. IIIL. LulllLIL-u vulul. IIIuJ'l UL. ucnluccll a. ullu u Illuluanr: Illlhlh- o 1 = a musthave item 0 2 2 important to have item 0 3 2 want to have item Display an appropriate error message if the entered value is out of range Validation must be nested in an iteration construct repeating until a valid value is entered c} Finance Options A character value representing if an item has nancing options [don't need to pay entire value upfront] The entered value can only be a lowercase y or n Display an appropriate error message if the entered value is not a y or n Validation must be nested in an iteration construct repeating until a valid value is entered 7. After storing the data to parallel array's, display a formatted table of the data entered - Use the following printf statements for the table header: printf("Item Priority Financed Cost'm"); printf(" \ "); 0 Use the following printf formatting to display each wish list item record: printf( "553d %5d %5c %11.Zlf\ ", 8. After all the data is displayed, summarize it with the total of all the item costs. Use the following printf statement to properly align it with the appropriate Cost column: printf(" \ "); printf(" $%11. Zlf\ \ ", 9. Finally, before ending the application, display an exit message Part1 D utput Exam 9 le (Note: Use the YELLOW highlighted userinput data for submission} + + + Wish List Forecaster I + + Enter your monthly NET income: $6 ERROR: You must have a consistent monthly income of at least $568.89 Enter your monthly NET income: $586896 ERROR: Liar! I'll believe you if you enter a value no more than $489386 Enter your monthly NET income: $6588.58 How many wish list items do you want to forecast?: B ERROR: List is restricted to between 1 and 18 items. How many wish list items do you want to forecast?: 11 ERROR: List is restricted to between 1 and 18 items. How many wish list items do you want to forecast?: 3 Item1 Details: Item cost: $39838.15 How important is it to you? [1:must have, 2=important, 3=want]: 8 ERROR: Value must be between 1 and 3 How important is it to you? [1:must have, 2=important, 3=want]: 4 ERROR: Value must be between 1 and 3 How important is it to you? [1:must have, 2=important, 3=want]: 1 Does this item have financing options? [yin]: N ERROR: Must be a lowercase 'y' or 'n' Does this item have financing options? [yin]: V ERROR: Must be a lowercase 'y' or 'n' Does this item have financing options? [yin]: k ERROR: Must be a lowercase 'y' or n Does this item have financing options? [yin]: n Item2 Details: Item cost: $99.99 ERROR: Cost must be at least $188.89 Item cost: $12BBBBG How important is it to you? [1:must have, 2=important, 3=want]: 3 Does this item have financing options? [yin]: y Item3 Details: Item cost: $358586.25 How important is it to you? [1:must have, 2=important, 3=want]: 2 Does this item have financing options? [yin]: n Item Priority Financed Cost 1 1 n 39639.15 2 3 y 1289699.98 3 2 n 359593.25 $ 158953648 Best of luck in all your future endeavours! Part-1 Submission 1. Upload [le transfer] your source le \"pr1 . c" to your matrix account 2. Login to matrix in an 55H 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 -'n|a11 w6p1.c -o H5 {ENTER} if there one no errors/warnings generated, execute it: HE CENTER.) 4. Run the submission command below [replace profname.proflastname with your professors Seneca userid and replace NM with your section]: ~pro-FNarne . proflastname! submit 144w61HAA_p1 5. Follow the on-screen submission instructions Part-2 40% Instructions Code your solution to Part-2 in the provided \"w6p2.c" source code file. Upgrade the solution to Part1 to include an analysis of the entered data and provide the forecasted number of years and months it will take to save enough to purchase the wish list items. 1. Review the "Part2 Output Example" [next section] to see how the program is expected to work 2. Display a menu with three [3} options: 1. All Items {no filter] 2. By priority 2. By priority 0. Quithxit Note: - Prompt for a menu selection; where valid values are from D to 2 o The menu should be in an iteration construct and only exit 1" end the program when Dis entered by the user If 0 is entered, the program should display the exit message and end 0 DO NOT use spaghetti code tactics by forcing the iteration tojump out of the iteration using statements like break, exit, or gate 0 Use a control variable lflagl to oontrol the flow If an invalid value is entered {that is not a 1, 2, or 0}, then display an appropriate error message and continue to iterate and prompt for a valid menu selection When option 1 is entered, iterate a_H wish list items and: - Accumulate {total} each item cost 0 Check if the item has financing options [value will be 'y'} and make note if it [this will be used later to show an additional "note\" in the summary output} When option 2 is entered: - This will follow the same directions as described in #5 only you will not accumulate {total} all the items, but will only consider items that match on the user entered priority value 0 Therefore, before iterating, you must prompt the user to specify a priority level to filter by [valid values are 1 to 3] 0 Display an appropriate error message if the entered value is out of range 0 Validation must be nested in an iteration construct repeating until a valid value is entered - Just as described in #5, accumulate the item cost and check for nancing options [only for the items that match on the specified priority level] 7. After menu options 1 or 2, display a forecast summary: 0 The summary should be wrapped {first and last line] with a double line. Use the following: print-H" \ " 2|; 0 Display the appropriate lter used to generate the results [based on option 1 or option 2}: print'"Filter: All items'm"); H [option1] print-F("Filter: by priority (%d}\ " . .. H [option2] - Display the total cost of the items {derived from the filtering option selected] print-H "Amount: $%1 . 21-F\ ", - Display the forecasted number of years and months it will take to save enough to purchase the items. Hint: The modulus operator will help you greatly with this! 0 Display an extra "Note\" only if any of the items had financial options to indicate that a shorter time is likely possible Part2 Output Example [Note: Use the YELLOW highlighted userinput data for submission} + + + Wish List Forecaster I + + Enter your monthly NET income: $8 ERROR: You must have a consistent monthly income of at least $588.88 Enter your monthly NET income: $588888 ERROR: Liar! I'll believe you if you enter a value no more than $488888.88 Enter your monthly NET income: $6225.88 How many wish list items do you want to forecast?: 8 ERROR: List is restricted to between 1 and 18 items. How many wish list items do you want to forecast?: 11 ERROR: List is restricted to between 1 and 18 items. How many wish list items do you want to forecast?: 5 Item1 Details: Item cost: 339838.15 How important is it to you? [1=must have, 2=important, 3=want]: 8 How important is it to you? [1:must have, 2=important, 3=want]: 9 ERROR: Value must be between 1 and 3 How important is it to you? [1:must have, 2=important, 3=want]: 4 ERROR: Value must be between 1 and 3 How important is it to you? [1:must have, 2=important, 3=want]: 1 Does this item have financing options? [yfn]: N ERROR: Must be a lowercase 'y' or 'n' Does this item have financing options? [yfn]: Y ERROR: Must be a lowercase 'y' or 'n' Does this item have financing options? [yfn]: k ERROR: Must be a lowercase 'y' or n Does this item have financing options? [yfn]: n Item2 Details: Item cost: $99.99 ERROR: Cost must be at least $166.86 Item cost: $1296998 How important is it to you? [1:must have, 2=important, 3=want]: 3 Does this item have financing options? [yfn]: y Item3 Details: Item cost: $358598.25 How important is it to you? [1:must have, 2=importantJ 3=want]: 2 Does this item have financing options? [yfn]: n Item4 Details: Item cost: $15568.75 How important is it to you? [1:must have, 2=importantJ 3=want]: 1 Does this item have financing options? [yfn]: y Item5 Details: Item cost: $6575.55 How important is it to you? [1=must have, 2=importantJ 3=want]: 3 Does this item have financing options? [yfn]: n Item Priority Financed Cost 1 1 n 39836.15 1 1 n 39836.15 2 3 y 12BBBBB.@B 3 2 n 356589.25 4 1 y 15599.25 5 3 n 6575.55 $ 1611606.?8 How do you want to forecast your wish list? 1. All items (no filter) 2. By priority 9. Quithxit Selection: 3 ERROR: Invalid menu selection. How do you want to forecast your wish list? 1. All items (no filter) 2. By priority 6. Quithxit Selection: 1 Filter: All items mount: $1611686.79 Forecast: 21 years, 7 months NOTE: Financing options are available on some items. You can likely reduce the estimated months. How do you want to forecast your wish list? 1. All items (no filter) 2. By priority 9. Quithxit Selection: 2 what priority do you want to filter by? [13]: 1 Filter: by priority (1) Amount: $5453B.96 Forecast: 6 years, 9 months NOTE: Financing options are available on some items. You can likely reduce the estimated months. How do you want to forecast your wish list? 1. All items (no filter) 2. By priority 3. Quithxit Selection: 2 What priority do you want to filter by? [13]: 2 Filter: by priority (2) Amount: $356588.25 Forecast: 4 years, 9 months How do you want to forecast your wish list? 1. All items (no filter) 2. By priority 6. Quithxit Selection: 2 What priority do you want to filter by? [13]: 3 Filter: by priority (3) Amount: $12665?5.55 Forecast: 16 yearsJ 2 months NOTE: Financing options are available on some items. You can likely reduce the estimated months. How do you want to forecast your wish list? 1. All items (no filter) 2. By priority 3. Quithxit Selection: 8

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions