Question: C++ Coding Problem. - Two Dimensional Table of Fruit sorted into 26 separate arrays, each array holding fruit starting with a letter of the alphabet.
C++ Coding Problem. - Two Dimensional Table of Fruit sorted into 26 separate arrays, each array holding fruit starting with a letter of the alphabet.
( Hint: Draw a diagram/table/illustration - an Array of Arrays - to help you )
Part 1 - Define 3 classes -
1) Define a Date class
Write a Date class with variables mm, dd, yyyy, and the needed functions.
2) Define a 'Single Fruit class' - ( Composed with date class )
Write a class, aFruit, that can store the name of a fruit, the price per item and the date entered in the system , and needed functions
3) Define a 'List of Fruits class ( Dimension 1 ) - ( Composed with Single Fruit class )
Write a class, myFruitList, that can store a list of 10 fruits in an array, and the needed functions, be sure to have a sort function in the class.
4) Define an array of 26 'Lists of Fruits' class. ( Dimension 2 ) - ( Composed with a List of Fruit classes )
Write a class, that can create an array of 26 myFruitListArrays classes, and the needed functions, be sure to have a function that call the sort function each index in the array (that list of fruit class)
5) Create a file of 130 different fruits: 5 fruit starting with the same letter, do so for all 26 letters of the alphabet.
Each line contains: a Fruit name, its price, it entry date. ( Be sure fruit order is RANDOMIZED in the file, AFTER you are done typing them in )
Store in a Text file called: myFruitFile.txt
Part 2 - Declare instance of a class
1) Declare an instance of the 'ListOfFruits' class. listOfFruits LOF;
Part 3 - Use the class
1) Call the function that reads the myFruitFile into the LOF instance, and places each fruit in the correct list.
2) Call the sort function to sort each 26 fruit lists
3) Call a function that Prints out all the fruit information, for fruit starting with letters:
- a) A
- b) O
4) Search and print the information for Lemons'
5) Search and print the information for Oranges

Part 1 - Define 3 classes - 1) Define a Date class Write a Date class with variables mm, dd, yyyy, and the needed functions. 2) Define a 'Single Fruit class' - ( Composed with date class ) Write a class, a Fruit, that can store the name of a fruit, the price per item and the date entered in the system, and needed functions 3) Define a 'List of Fruits class' (Dimension 1 ) - ( Composed with Single Fruit class ) Write a class, myFruitList, that can store a list of 10 fruits in an array, and the needed functions, be sure to have a sort function in the class. 4) Define an array of 26 'Lists of Fruits' class. (Dimension 2) - (Composed with a List of Fruit classes ) Write a class, that can create an array of 26 myFruitListArrays classes, and the needed functions, be sure to have a function that call the sort function each index in the array (that list of fruit class) 5) Create a file of 130 different fruits: 5 fruit starting with the same letter, do so for all 26 letters of the alphabet. (Be sure fruit order is RANDOMIZED in the file, AFTER Each line contains: a Fruit name, its price, it entry date. you are done typing them in ) Store in a Text file called: myFruitFile.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
