Question
TASK I: Create Parallel Arrays Begin by creating three parallel arrays populated with the following data (be careful with your data entry!). Give your arrays
TASK I: Create Parallel Arrays
Begin by creating three parallel arrays populated with the following data (be careful with your data entry!). Give your arrays meaningful names, such as cakes, prices, and days.
CAKE PRICE ORDER TIME (DAYS)
---- ----- -----------------
Red Velvet Supreme $29.95 1
Death by Chocolate $44.95 2
Average cost of cake at Sweet Dreams: 32.95
Thank you for your order. Enjoy!
Unicorn Rainbow Cake $24.95 1
Warm Pumpkin Spice $29.95 1
Blueberry Cheesecake $34.95 2
English Pudding Cake $29.95 2
Salted Turtle Cake $39.95 2
Hot Fudge Sundae $24.95 1
Funfetti Sprinkles $19.95 1
TASK II: Bubble Sort
Code a bubble sort to sort the cakes lowest to highest according to price. When you swap, dont forget to swap elements across all three parallel arrays!
TASK III: Display and Average
Write a loop to 1) loop through and print the sorted cake data in parallel and 2) accumulate a running total, which you will later (i.e., after the loop) divide to get an average price for the cakes.
Use the output below as your guide. Use setwto get your columns to line up. Also note the hard-coded dollar signs on the prices and the average.
Output:::::
CAKE PRICE ORDER TIME (DAYS)
---- ----- -----------------
Funfetti Sprinkles $19.95 1
Unicorn Rainbow Cake $24.95 1
Hot Fudge Sundae $24.95 1
Red Velvet Supreme $29.95 1
Warm Pumpkin Spice $29.95 1
English Pudding Cake $29.95 2
Blueberry Cheesecake $34.95 2
Salted Turtle Cake $39.95 2
Death by Chocolate $44.95 2
Molten Lava Chocolate $49.95 2
Average cost of cake at Sweet Dreams: $32.95
Thank you for your order. Enjoy!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started