Car Showroom

 

A menu-driven program allows a manager of a car showroom to process stock data.

All of the showroom data is stored in a file called CarSales.txt.

A menu-driven program is required. Here is a prototype of the program that is being developed.

3 functions need to be designed:

def carCount()

This function opens the data file and processes it line by line.

It asks the user which model of car they want to count and displays the result.

def displayAveragePrice()

This function opens the data file and processes it line by line.

It calculates the average price of all of the cars in the data file and displays the result.

def salesDate()

This function opens the data file and processes it line by line.

It asks the user to enter a valid sales date and displays all information of all cars that were sold on that date.

Decompose the problem

One tip is to make a list of things that your program needs to do before you start coding - you could do this as comments in Python eg

#create an empty array

#create a loop to do something 5 times

#ask the user to input a number in the loop

#append the number to the array in the loop

#calculate statistics in the loop

#display all data and statistics after the loop

Then... start coding!