(Solved) : Needs Programmed C Introduction President Software Company Ceo Gmu S Bike Share Company Co Q41333804 . . .

Needs to be programmed in C.

Introduction:
You are the president of a software company.  The CEO ofGMU’s bike share company has contacted you with aproposal.  He wants your company to build a new computersystem to track and analyze bike trip operations.  Hewill send you a data set that contains bike trips made in one dayfor you to use to create a prototype. The computer system youdesign will need to process this data.

The bike share company has two types ofmembership payment plans.  Acasual rider is not registered and paysfor one bike trip at a time.  Aregistered rider signs up for a longerterm and pays a flat annual rate for unlimited rides at a lowercost. Each trip record contains the start and end bike sharestations.  A start station is alocation where riders check a bike out of a docking station whenthey begin a bike trip.  An endstation is a location where riders will check a bikeinto a docking station when they end a trip. Each record alsocontains some time variables that you can use to compute the timeand length of each trip.  The records will contain thehour that the trip started in a 24-hourclock (military time), and the minutesthat have passed during thathour.  Example:  hour = 16 and minutes = 30means that trip started at 4:30 pm. There is also aduration variable that contains thelength of time of each trip in milliseconds.  And lastbut not least, each record contains theID number of the bike that was ridden inthe trip.

In order for the CEO to run his bike share operations, yoursystem will need to process the data and provide him with thefollowing types of information:

·      The busiest time of day,when there are the most bike trips

·      The busiest stations

·      The slowest stations

·      The average time of all thebike trips

·      The longest and shortestbike trips

The CEO also needs to monitor the inventory of bikes and set upa quality control process to identify the bikes that get the mostuse so that they can be flagged for maintenance.  He hasasked you to create an inventory list of all the bikes and tracksome key metrics on each bike.  He will need to knowwhich bikes are getting the most use and where they are located atthe end of the day.

Specifications:
You are given a text file with data on trips. You will need to readthis data into an array.  Each row will contain one tripstruct with the definition provided below.

  typedef struct Trip_struct{

     char membershipType[12];

     int startStationId, endStationId,bikeId,

         duration,startHr, startMin;

  }Trip;

The order of the fields in each row is

MembershipType

StartStationId

EndStationId

BikeId

Duration

Hour

Minute

Here are the specifications for your system:

  1. Information for each trip will be kept in a single data type(struct) and will consist of:
    • A bike ID (integer)
    • A membership Type (char string of 12 characters)
    • A start station ID (integer)
    • An end station ID (integer)
    • The duration of the trip in milliseconds (integer)
    • The hour in which the trip started in military time(integer)
    • The minute at which the trip started (integer)
  2. The trip data will be read from an ASCII file at the start ofthe program. The data fields will be those listed above, separatedby white space.  Each line in the file will contain asingle struct.
  3. Use malloc to allocate space to store the trip array.
  4. After reading in the data, your system will need to providemenus that the users of your system will navigate to obtainmetrics.
  5. The metrics that users will need are as follows:
    • Average number of trips per hour
    • The hour with largest number of trips
    • A report of the count of trips in each hour
    • Average duration of the trips (in both milliseconds andminutes)
    • The trip with the longest duration (in both milliseconds andminutes)
    • The 5 busiest starting stations (that had the largest number oftrips in the day)
    • The 5 busiest ending stations (that had the largest number oftrips in the day)
    • The percentage of trips in each membership type

To create the inventory of bikes, you will use a bike structwith the definition provided below.  

typedef struct Bike_struct{

   char maintenanceFlag;

   int bikeId, endStationId;

   int numTrips, totalDuration;

float totalMinutes;

}Bike;

You will need to create a second separate array of bike structs byimplementing the following data structure and functions.

  1. Information for each bike will be kept in a single data type(struct) and will consist of:
    • A bike ID, each struct will have a unique bike ID(integer)
    • A maintenance flag (character)
      • ‘0’ default value
      • ‘1’ when flagged for maintenance
    • An end station ID (integer)
    • The number of trips (integer)
    • The total duration of all the trips for this bike(integer)
    • The total minutes of all the trips for this bike (float)
  2. You need to create an array of bike structs.  Makethe size of the array 4,000 elements.  This will providesome empty rows for adding new bikes to the inventory.
  3. Creating a list of unique bike IDs can be done in the followingsteps:
    • Sort the trip array by bike ID using a quick sortalgorithm
    • Create an empty bike array of 4,000 bike structs
    • Write a function that loops through the trip array, copyingonly unique bike IDs into the bike array
    • Write a function that loops through the trip array and updatesthe rest of the data members in each bike struct
  4. The CEO of the bike share company has requested the followingmetrics on the bike inventory:
    • The 10 bikes with the longest duration in minutes
    • Where the 10 bikes above are located at the end of the day
    • The 10 bikes with the most trips
    • How many bikes were only used for 2 or less trips
    • For the bikes with 2 or less trips, make a list of the startstation IDs and the number of trips for each of these stations
  5. The CEO has also requested that your system is able to add andremove bikes from the inventory list

Implementation:
The specifications for this project have a great deal of detail.However, the fact that they are detailed can be used to youradvantage, in that you can break the project into smaller units andwork on them separately to create the complete project.

  1. You will implement this program using arrays of structs. Youwill read data from an input text file into anarray.  Then you will use the data in this array tocreate a second separate array of 4,000 bike structs.
  2. You will need to be able to sort the arrays by any given datamember using quick sort.
  3. Your program will be menu driven. As you create and workthrough your menus, use stubs as place holders until you write thecode. The program will contain a main menu, and several choicesfrom this menu will bring up a sub-menu. See the MenuSpecifications below.
  4. An input file containing the trip data is provided.
  5. A sample script and sample output will hopefully be providedthat you may test with your program (depending upon time). Ifprovided, your program must respond to inputs in the same mannerthat the sample script responds. In other words, your programshould not add unnecessary prompts for user input, nor should itskip prompts for input (or prompt for multiple data items with asingle prompt). If the script cannot be provided in a timely manner(approximately one week before the due date), then this requirementwill not be necessary.

Menu Specifications:

  • Main Menu: The main menu will contain thefollowing choices and functionality:
    1. Read Trip Data
      1. Prompt the user for a file name containing the trip data.
      2. Open this file and read the information from the file, creatingan array of Trip structs.
      3. If the file cannot be found, print a message stating this fact,and return to the Main Menu.
    2. Run Metrics
      1. Display the Metrics Menu (See below)
    3. Print Menu
      1. Display the Print Menu (See below)
    4. Flag Bikes for Maintenance
      1. Make a list of the 10 bikes with the longest duration
      2. Update the maintenance flag to ‘1’
    5. Update Bike Inventory
      1. Add a bike
      2. Remove a bike
    6. Quit
      1. Exit the program
  • Metrics Menu:
    1. The user is presented with a list of metrics from thespecifications above
      1. The program prompts the user to choose a metric.
      2. The program prompts the user to choose whether to display themetric on the screen or write the result to an output file.
      3. If an output file is chosen, the program prompts the user totype in the name of the output file.
    2. Return to Main Menu
  • Print Menu:
    1. Print All the Trip Data
      1. The program prompts the user to choose whether to display themetric on the screen or write the result to an output file.
      2. If an output file is chosen, the program prompts the user totype in the name of the output file.
      3. Return to Main Menu
    2. Print All the Bike Inventory
      1. The program prompts the user to choose whether to display themetric on the screen or write the result to an output file.
      2. If an output file is chosen, the program prompts the user totype in the name of the output file.
      3. Return to Main Menu
    3. Print the CEO Report
      1. The program prompts the user to type in the name of the outputfile.
      2. All the metrics for the trips and the bikes are printed to theoutput file in a nicely formatted style that is easy to read.
      3. Return to Main Menu
    4. Print one Bike
      1. The program prompts the user to enter a bike ID
      2. The program prompts the user to choose whether to display themetric on the screen or write the result to an output file.
      3. If an output file is chosen, the program prompts the user totype in the name of the output file.
      4. Return to Main Menu

Expert Answer


Answer to Needs to be programmed in C. Introduction: You are the president of a software company. The CEO of GMU’s bike share co…