Question: Create a class called Peach as follows. Set up two private member variables for ID ( char ) and price ( double ) . Create
Create a class called Peach as follows.
Set up two private member variables for ID char and price double
Create a public accessor and a public mutator for each member variable.
Create a nonmember function outside of the class Peach that takes in an array of Peach objects Peach and the size of the array as parameters and returns a Peach object that costs the cheapest price.
Write a C program to find the cheapest peach as shown in the test cases.
Notes:
Your program should create an array of Peach objects and call or use all the member functions of the Peach objects.
Your program should perform a simple input validation as shown in the test cases.
At the top of your file, your program must include a file name, short description of the program, and your name as a multipleline C comment.
Test Cases:
Enter the number of peaches num:
Enter the number of peaches num:
Enter the number of peaches num:
Enter the ID of Peach : X
Enter the price of Peach :
Enter the ID of Peach :
Enter the price of Peach :
Enter the ID of Peach : Z
Enter the price of Peach :
Peach costs $
COP C Programming for Engineers
Module Individual Coding Assignment MICA: Structures and Classes
Peach Y costs $
Peach Z costs $
The cheapest peach is Peach for $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
