Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ba Octombowanden The committed what the The power the Wash wolpet Wo from there for me nrX 3579 het meest tid til Sare 25 Using

image text in transcribed
image text in transcribed
image text in transcribed
ba Octombowanden The committed what the The power the Wash wolpet Wo from there for me nrX 3579 het meest tid til Sare 25 Using the given struct below.create the two following void fill_train(train care train, FILE *fp) (50 points) This function takes an array of train_carstructs and fills each struct with info from a file (sample file gi array is size 3 (hint: the easiest way to do this is to read in the file a specific way). The price member void print_train(train_car train, int size) (30 points) This function prints out the info from the struts that make up the trainarray. For the sample file given Train car 1: 25 passengers, price: $10.99 Train car 2:30 passengers, price: $10.99 Train car 3: 4 passengers, price: $5.99 (10 points-correctly accessing each array, 7.5 points-correctly printing each passenger amount. 7.5-correctly Struct: typedef struct train carf int num passengers: char size: float price; Itrain_car: Sample File: 25-mlumber of passengers-size 30-1 4-5 = O words BO ations points if you do this alven below.do not HARDCODE THE FILE) (20 points). The size of the array is determined by the number of lines in the file (spoints for example, if a file has 3 lines of info, then that means the wer in a struct should be 5.99 the number of passengers is less than 10 (10 pointsland 10.99 otherwise (10 points. Don't forget to close the file when you are done (5 points ven the output would look like Trectly printing cach price, 5 points-overall correct match for each line in the sample run ba Octombowanden The committed what the The power the Wash wolpet Wo from there for me nrX 3579 het meest tid til Sare 25 Using the given struct below.create the two following void fill_train(train care train, FILE *fp) (50 points) This function takes an array of train_carstructs and fills each struct with info from a file (sample file gi array is size 3 (hint: the easiest way to do this is to read in the file a specific way). The price member void print_train(train_car train, int size) (30 points) This function prints out the info from the struts that make up the trainarray. For the sample file given Train car 1: 25 passengers, price: $10.99 Train car 2:30 passengers, price: $10.99 Train car 3: 4 passengers, price: $5.99 (10 points-correctly accessing each array, 7.5 points-correctly printing each passenger amount. 7.5-correctly Struct: typedef struct train carf int num passengers: char size: float price; Itrain_car: Sample File: 25-mlumber of passengers-size 30-1 4-5 = O words BO ations points if you do this alven below.do not HARDCODE THE FILE) (20 points). The size of the array is determined by the number of lines in the file (spoints for example, if a file has 3 lines of info, then that means the wer in a struct should be 5.99 the number of passengers is less than 10 (10 pointsland 10.99 otherwise (10 points. Don't forget to close the file when you are done (5 points ven the output would look like Trectly printing cach price, 5 points-overall correct match for each line in the sample run

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago