Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2: Code (80 points) Using the given struct below, create the two following functions (do not modify the function void fill_train(train car train, FILE

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Problem 2: Code (80 points) Using the given struct below, create the two following functions (do not modify the function void fill_train(train car train, FILE *fp) (50 points) This function takes an array of train_carstructs and fills each struct with info from a file (sampl array is size 3 (hint: the easiest way to do this is to read in the file a specific way). The price m 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 fil 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-c Struct: typedef struct train car int num passengers: char size; float price: train car: Sample File: 25-m umber of passengers-size 30-1 HE FILE) (20 points). The size of the array is determined by the number of lines in the file (5 points), for example, if a file has 3 lines of info, then that means umber of passengers is less than 10 (10 points)and 10.99 otherwise (10 points). Don't forget to close the file when you are done (5 points) -erall correct match for each line in the sample run) ES VAN Question 2 Problem Code 10 Udvent.create the world action dedirtti vold cartra FILES This function the way of the event. AADKOO THE PLOT MO anayet viest way to do that the others who 1000. Dos coste wed/ The action priestorom the stomach. For the love I would T125g 50:29 Trenca 2.00 5309 110 poco che che corpore marche SINCE det Wenger Sama 301 HE FILE) (20 points). The size of the array is determined by the number of lines in the file (5 points), for example, if a file has 3 lines of info, then that means umber of passengers is less than 10 (10 points)and 10.99 otherwise (10 points). Don't forget to close the file when you are done (5 points) -erall correct match for each line in the sample run) 54 words BOF function declaration points you do the fle sample we given below.do not HARDCODE THE FILE (20 points. The size of the array is determined by the number of lines in the files points for example, thus lines of into the trust means the The price member instruct should be the number of paris less than 100 points and 10.99 otherwise (10 points. Don't forget to close the file when you are done 5 point the sample Meglven the output would look nout, Scanding each peke. 5 powers.comvet match for each one in the sole run Problem 2: Code (80 points) Using the given struct below, create the two following functions (do not modify the function void fill_train(train car train, FILE *fp) (50 points) This function takes an array of train_carstructs and fills each struct with info from a file (sampl array is size 3 (hint: the easiest way to do this is to read in the file a specific way). The price m 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 fil 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-c Struct: typedef struct train car int num passengers: char size; float price: train car: Sample File: 25-m umber of passengers-size 30-1 HE FILE) (20 points). The size of the array is determined by the number of lines in the file (5 points), for example, if a file has 3 lines of info, then that means umber of passengers is less than 10 (10 points)and 10.99 otherwise (10 points). Don't forget to close the file when you are done (5 points) -erall correct match for each line in the sample run) ES VAN Question 2 Problem Code 10 Udvent.create the world action dedirtti vold cartra FILES This function the way of the event. AADKOO THE PLOT MO anayet viest way to do that the others who 1000. Dos coste wed/ The action priestorom the stomach. For the love I would T125g 50:29 Trenca 2.00 5309 110 poco che che corpore marche SINCE det Wenger Sama 301 HE FILE) (20 points). The size of the array is determined by the number of lines in the file (5 points), for example, if a file has 3 lines of info, then that means umber of passengers is less than 10 (10 points)and 10.99 otherwise (10 points). Don't forget to close the file when you are done (5 points) -erall correct match for each line in the sample run) 54 words BOF function declaration points you do the fle sample we given below.do not HARDCODE THE FILE (20 points. The size of the array is determined by the number of lines in the files points for example, thus lines of into the trust means the The price member instruct should be the number of paris less than 100 points and 10.99 otherwise (10 points. Don't forget to close the file when you are done 5 point the sample Meglven the output would look nout, Scanding each peke. 5 powers.comvet match for each one in the sole 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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

3. Job rotation is used for all levels and types of employees.

Answered: 1 week ago