Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ is the Language 3. Write a function that takes a two-dimensional array of integers and two row indices, rowA, and rowB. The function should
C++ is the Language
3. Write a function that takes a two-dimensional array of integers and two row indices, rowA, and rowB. The function should swap rowA and rowB. Test your function. Your testing program should print the array before and after the swapping. 4. Write a function that takes a two-dimensional array of integers and a col index. The function should return the average values in the column. Test your function. Duckey Donald 85 Goof Goofy 89 Brave Balto 93 Snow Smitn 93 Alice Wonderful 89 Samina Akthar 85 Simba Green 95 Donald Egger 90 Brown Deer 86 Johny Jackson 95 Greg Gupta 75 Samuel Happy 80 Danny Arora 80 Sleepy June 70 Amy Cheng 83 Shelly Malik 95 Chelsea Tomek 95 Angela Clodfelter 95 Allison Nields 95 Lance Norman 88 Plain Egg 1.45 Bacon and Egg 2.45 Muffin 0.99 French Toast 1.99 Fruit Basket 2.49 Cereal 0.69 Coffee 0.50 Tea 0.75 Exercises 1. Write a program that reads (from a file) students' names followed by their test scores. The program should output each student's name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and student.Name of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Your program must contain at least the following functions: A function to read the students' data into the array. b. A function to assign the relevant grade to each student. A function to find the highest test score. d. A function to print the names of the students having the highest test score. Your program must output cach student's name in this form: last name followed by a commn, followed by a space, followed by the first name; the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls. c. 2. Write a program to help a local restaurant automate its breakfast billing system. The program should do the following: a. Show the customer the different breakfast items offered by the restaurant b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill. Assume that the restaurant offers the following breakflust items (the price of each item is shown to the right of the item): Plain Egg S145 Bacon and Egg $2.45 Muffin $0.99 French Toast ST.99 Fruit Basket $2.49 2. Write a program to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Plain Egg $1.45 Bacon and Egg Muffin French Toast $1.99 Fruit Basket $2.49 $0.69 Coffee S0.50 Tea $0.75 $2.45 $0.99 Cereal Use an array menulist of structure type menultemType, whereas the structure menuitemType has with two components: menultem of type string and menuPrice of type double. Your program must contain at least the following functions: Function getData: This function loads the data into the array menuList. Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items Function printCheck: This function calculates and prints the check. (Note that the billing amount should include a 5% tax.) A sample output is: Welcome to Johnny's Restaurant Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items. Function printCheck: This function calculates and prints the check. (Note that the billing amount should include a 5% tax.) A sample output is: Welcome to Johnny's Restaurant Dr. Naveed Bin Rais COE212 - Programming for Engineers II Bacon and Egg Muffin Coffee Tax Amount Due $2.45 S0.99 $0.50 S0.20 S4.14 Format your output with two decimal places. The name of each item in the output must be left justified. You may assume that the user selects only one item of a particular type
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