Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Exercise 2) Create -courselnfo.cpp In this exercise you will expand your timelnput.cpp, which only deals with lecture times, so that you can have more information

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

(Exercise 2) Create -courselnfo.cpp In this exercise you will expand your timelnput.cpp, which only deals with lecture times, so that you can have more information about each lecture, and print a schedule to the student. More specifically, you should keep your Time structure from timeInput.cpp and create a new Course structure consisted of the following variables: 1. name, type string, which stores the name of the course 2. credits, type int, which stores the number of credits for the course major Requirement, type bool, which tells if the course is a requirement for your 3. major 4. avgGrade, type double, which gives the average grade (in percentage) that past students received in the course 5. days, type string, which stores the days that lectures are held 6. startTime, type Time (from exercise 1), which is the start time of the lecture 7. endTime, type me (from exercise 1), which is the end time of the lecture Your program should read the course information from a text file called "in.txt". This file should contain the following pieces of information on the lines specified below: Line 1: Course number: How many courses the user wants to sign up for. Line 2: Name of the course Line 3: Credits Line 4: Is the course a major requirement? (1 yes, 03no) Line 5: Average grade for the course Line 6: Lecture days Line 7: Start time of the lecture Line 8: End time of the lecture Line 9-15: Repeat same information for additional course, if it exists Note: In order to receive full credit for this part of the lab, you MUST create the two structures, Time and Course, consisted of the proper variables In order to read the avgGrade, you will need to convert from strings to floats. The function you can use to do so is atof, which takes in an array of characters as a parameter (again, NOT a string). To convert a string to an array of characters, use the function C stro

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions