Write a c program that defines a data type

Assignment Help C/C++ Programming
Reference no: EM132194772

Question: Write a C program that defines a data type (structure ) called course which includes the following fields on Computer Science courses:

Course name (string) e.g. comp230

(All course names start with the word "comp" followed by a three digit number for the course's number). The first of those numbers indicates the year level of the course (e.g. comp230 is for second year level students, while comp132 is for first year level students, and comp438 is for fourth year level students).

Number of students in course (integer)

Course's average grade (double)

Your program should read the information for up to a maximum of 20 courses from a file called course_info.txt and store it in an array of structures called courses.

Your program should then print the average grade for all first year courses, second year courses, third year courses, and fourth year courses as well as the highest of those averages.

Example:

Assume the file course_info.txt contains the following data:

comp132 50 71.30

comp230 73 68.72

comp142 72 75.6

comp232 90 62.73

comp432 30 70.23

Then your program should print the following result:

First year courses avg = 73.84

Second year courses avg = 65.41

Third year courses avg = No courses

Fourth year courses avg = 70.23

The highest average = 73.84

Note: Notice that the average calculations take into consideration the number of students in each course for example:

To calculate first year student average the program does the following:

(71.3 * 50 + 75.6 * 72) / ( 50 + 72) = 73.84

You need to turn in the following items:

A hard copy of your C program with your name, id, and section # typed on it as well as a hard copy of the content of file course_info.txt.

A hard copy of one complete successful run of your program (similar to that shown above)

Reference no: EM132194772

Questions Cloud

Write a c program that contains a structure : Write a C program that contains a structure that uses predefined types and union. Create a struct with name, age, kind (Either child, college student, or adult)
A c program that will check the current setting of echo : Write a C program that will check the current setting of "echo". It it is on, display the message and turn it off.
Write a program to create two files : Write a C++ program to create two files named abc.txt which contains the text I love C++ Programming and def.txt which contains the text.
A program for the frequency histogram : Write a C++ program (c++14). ask the user give some inputs. and then output the frequency histogram of them.
Write a c program that defines a data type : Write a C program that defines a data type (structure ) called course which includes the following fields on Computer Science courses.
Calculate the product of the two integers : The function takes two integers as arguments and calculates the product of the two integers. The function will return the product.
The user for a positive number n representing the number : Write a C program called sort.c that first prompts the user for a positive number n representing the number of numbers to be sorted.
Ask the user to enter a time in the format : Write a c++ program that asks the user to enter a time in the format HH:MM, if all digits are the same print , "you lucky".
Mean an improvement in economic welfare : Explain why a high economic growth rate does not necessarily mean an improvement in economic welfare

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Appropriate structure to use to program the statement

A home improvement store is giving a discount of 20% on all purchases of more than $250. Which of the following is the appropriate structure to use to program the statement

  Applications presenting room booking

Write a windows applications presenting room booking. Add XML serialization to the application.Define a class Room that contains private information for the name, the size, the number of people than it can hold, booked/free, and the name of booker..

  Dynamic array of a string that takes in names

Can you please show me an example of a C++ Class that has a dynamic array of a string that takes in names by user input??

  Construct conditional expression that is equal to variable

Construct a conditional expression that is equal to the absolute value of a variable. That is, if a variable x is positive, value of the expression is just x.

  Linked list program

This lab, along with your TA, will help you navigate through designing, implementing, and testing a dynamic linked list.  Linked lists may be used to implement many real world applications. Recall, linked lists are data structures, which represent co..

  Find and print the largest number in the array

Write a C program that declares an (integer) array of size 10, prompts the user to enter 10 integers and stores them in the array. The program should then

  Write test driver to test the written methods

write the class specification, constructor, accessors and mutators and write test driver to test the written methods

  Write c program that prompt the user to enter a line of text

Write a C program that prompts the user to enter a line of text (up to 50 characters). It should then convert the text entered to uppercase letters and then to lowercase letters, and then to Sentence case.

  Design and code a swing gui to translate text

Design and code a Swing GUI to translate text that is input in English into Pig Latin. You can assume that the sentence contains no punctuation.

  Storing the data in random access binary file

As you recall, the project used text files to store the data. Here in the final exam project, you will be storing the data in Random Access Binary File.

  Write a program that will read in 4 test scores per line

Write a program that will read in 4 test scores per line. Print the total number of points earned, your program should work for any number of lines of data.

  Show the overall average miles per gallon.

I am unsure about the for loop. I understand how to write the code for the number of gallons used and miles driven, but unsure of how to get the overall average to display.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd