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

  Building a domain model for the mail order inventory system

Prepare a set of 3 UML class relationship diagrams highlighting important relations among the discovered classes. These diagrams must be accompanied by explanatory text - Carry out the early stages of building a domain model for the mail order inve..

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  Write an application that creates a quiz

Write an application that creates a quiz, which contains at least 5 questions about a hobby, popular music, astronomy, or any other personal interest. Each question can be multiple choice(a,b,c,d should be user accepted response), or true or false(t ..

  Write a program that creates a binary file

Write a program that creates a binary file by reading the data for the students from the terminal .The data of each student consist of roll no. ,name ( a string of 30 or lesser no. of characters ) and marks.

  Write a program to find the area of a circle

Write a program to find the area of a circle. The program should use two procedures. The first procedure will print out the program heading and ask the user to enter the radius.

  Write a program that reads and prints a joke

Write a program that reads and prints a joke and its punch line from two different files. The first file contains a joke, but not its punch line.

  Class to act as a generic array

Create a class to act as a generic array (i.e. the user will be able to choose the data type to be stored by passing the appropriate template argument.

  Computes the measure of an object.

This program tests the measurement of rectangles by perimeter.

  Write a program that calculates an employees wage for a

write a program that calculates an employees wage for a week. an employees wage is calculated as followsi if the number

  Perform different manipulation tasks

How can QTest automate the task of receiving details such as the name and surname from individuals for registration - What must Mr. Harrish do to avoid delay

  Struct definition as the page table entry

Struct definition as the page table entry and the array that follows it as the page table. Implement the software simulation of least recently used algorithm in two C++ functions. Should RUN on UNIX.

  Describe what kind of architecture the new payroll

you have been tasked with building a payroll program for a large organization with offices spread across the united

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