Computer science-intro to c problem

Assignment Help Basic Computer Science
Reference no: EM131921210

Computer Science - Intro to C++ Problem

You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA.

This site: https://www.back2college.com/gpa.htm shows you how to calculate a GPA.

Keep prompting the student if they want to add more courses.

IMPORTANT NOTES!

  • The course name is prompted for, but nothing is done with it.
  • We are just using the grades A, B, C, D, and F so you won't have to do so much typing!
  • You will need to use the "set precision" command Set it to "fixed" and "2".
  • You will need to use the "cin.ignore()" function as discussed earlier in the course.

This is what I have thus far:

#include <iostream>

#include <string>

using namespace std;

string course;

int credits;

string grade;

string answer;  

int main() {

  cout << "Enter a course name: ";

  getline(cin,course);

  cout << course;

  cout << endl;

   cout << "Enter number of credits: ";

  cin >> credits;

  cout << credits;

  cout << endl;

  cout << "Enter you grade (A, B, C, D, F): ";

  cin >> grade;

  cout << grade;

  cout << endl;

  cout << "Continue ('Yes' or 'No')? ";

  cin >> answer;

  cout << answer;

  cout << endl;

  return 0;

}

Do I need a while loop to ask questions, and I am assuming a:

if(grade == "A"){

gradePoint = credit * 4;

}

What about the "set precision" to a fixed 2 value and "cin.ignore()" in the program?

Reference no: EM131921210

Questions Cloud

Compute the amount of pension expense : Amortization of unrecognized prior service cost for the year 270,000, Compute the amount of pension expense for 2010. Be sure to show your work
What fraction of ownership in your idea do you need to sell : You have an idea that requires an investment of $60 today, What fraction of ownership in your idea (what percentage of E) do you need to sell?
Discuss the importance of cash flows to a business : View the you-tube videos below on cash flow. Discuss the following: - the difference of cash flow statements from balance sheets and net income.
Compute the annual payment : The lease required six annual payments, with the first payment due on December 31, 2010. Compute the annual payment
Computer science-intro to c problem : You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA.
In the black-scholes-merton option pricing formula : In the Black-Scholes-Merton option pricing formula N(d1) denotes (circle one)
Prepare all journal entries on spokane books : Spokane Company leased some equipment from another company on January 1, 2010, for a four-year period. Prepare all journal entries for 2010 on Spokane's books
What is the principal role of union in business environment : What is the principal role of a union in today's business environment? What is the purpose and effect of "Right-to-Work" laws in states that have enforced them?
Program stores test scores in two int variables : A program stores test scores in two int variables named myScore and expectedScore. Write the C++ code to compare the two scores

Reviews

Write a Review

Basic Computer Science Questions & Answers

  What is their barrier to entry

Google "synthetic diamonds" (using the quotation marks in your search) to learn about this threat to DeBeers. Based on your search results, do you think DeBeers will be able to maintain its monopoly? Include web citations for supporting evidence.

  Estimate the degree to which a neuron''s inborn abilities

Do these analyses allow you to draw some practical conclusions about the influence of your education on your career?

  Reproduce the van der pol oscillator model

Finally, examine b=5. Note the qualitative changes in the response function, i.e., in the plotted values of x.

  What is the running time of building an n-item arraylist

Suppose, however, the novice programmer invokes trim after each add. In that case, what is the running time of building an N-item ArrayList?

  Stymie generic competition

Why would the drug maker want to stymie generic competition? Explain your response.

  Does the ford-fulkerson algorithm ever use a backward edge

Does the Ford-Fulkerson algorithm ever use a backward edge?

  Consumption of goods

Joe College is a UT student.  His course schedule is set and his parents have already paid for his tuition, room, and board for the semester. Now Joe must decide how to allocate his time between "leisure" (which includes study time, socializing, etc...

  Ticket price based on the visitor

A local art gallery has tasked you with writing a computer program that computes the ticket price based on the visitor's age. Because of the high value of the art exhibits, only visitors 12 years and older are allowed in the art gallery.

  Write the above expression in summation notation

This problem is about adding the odd numbers; consider in particular 1 + 3+5+7+···+(2n-1).

  How to manage file resources with windows server

Demonstrate how to manage file resources with Windows Server.

  Examine the definition of bidirectional search

Devise a version of partial-order planning in which an action can be added to a plan if its preconditions can be achieved by the effects of actions already.

  What is the output stream

What is the length of the longest consecutive sequence of 0s in the output?

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