Question

In: Computer Science

In Object Oriented programming C++ : Write the appropriate functions for Student to neatly display a...

In Object Oriented programming C++ : Write the appropriate functions for Student to neatly display a Student, and then finally GPA. Have items neatly line up in columns.

I need help creating a derived class called student that finds GPA (between 0.0 and 4.0) and credits completed (between 0 and 199).

Solutions

Expert Solution

Source code:

#include <iostream>
using namespace std;

struct student
{
    char name[50];
    int roll;
    float Credits;
  
};

int main() 
{
student s;
    cout << "Enter the student information," << endl;
    cout << "Enter the student name: ";
    cin >> s.name;
    cout << "Enter roll number: "<<endl;
    cin >> s.roll;
    cout << "Enter Credits Completed(0 to 199): "<<endl;
    cin >> s.Credits;
   
    cout << "Displaying Information," << endl;
    cout << "Name: " << s.name << endl;
    cout << "Roll: " << s.roll << endl;
    cout<<"GPA and Grade: "<<s.Credits;
      
       if (s.Credits>150){
cout << "GPA 4 Grade: A"<<endl;
        }
        
        else if(150>s.Credits>100){
            cout<<"GPA 3 Grade: B"<<endl;
        
        }
            else if(100>s.Credits>50){
                cout<<"GPA 2 Grade: C"<<endl;
            }
                else if(50>s.Credits){
                   cout<<"GPA 1 Grade: D"<<endl;  
                } 
    
    return 0;
}

The output:


Related Solutions

Write a Windows Form application named SumFiveInts. Microsoft Visual C#: An Introduction to Object-Oriented Programming,7th Edition....
Write a Windows Form application named SumFiveInts. Microsoft Visual C#: An Introduction to Object-Oriented Programming,7th Edition. Ch. 5, page 220. Take snip of program results.
This is from Microsoft Visual C#: An Introduction to Object Oriented Programming by Joyce Farrell (7th...
This is from Microsoft Visual C#: An Introduction to Object Oriented Programming by Joyce Farrell (7th Edition) The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program. /* The program requires the user to guess the number of days it takes to make X amount of money when doubling the value every day. The starting value is $0.01. The program indicates if the guess is too high, or too low. */ using System; using static...
object oriented programming java Create a Student class that have two data members id (assign to...
object oriented programming java Create a Student class that have two data members id (assign to your ID) and name (assign to your name). Create the object of the Student class by new keyword and printing the objects value. You may name your object as Student1. The output should be like this: 20170500 Asma Zubaida
-What is object-oriented programming? -What is a class? -What is an object? -A contractor uses a...
-What is object-oriented programming? -What is a class? -What is an object? -A contractor uses a blueprint to build a set of identical houses. Are classes analogous to the blueprint or the houses? Explain. -What is a class diagram? How is it used in object-oriented programming? -What is an attribute in OOP? What is a data member? -What is a method in OOP? What is a member function? -What is the difference between private members and public members of a...
Kindly Do the program in C++ language Object Oriented Programming. Objectives  Implement a simple class...
Kindly Do the program in C++ language Object Oriented Programming. Objectives  Implement a simple class with public and private members and multiple constructors.  Gain a better understanding of the building and using of classes and objects.  Practice problem solving using OOP. Overview You will implement a date and day of week calculator for the SELECTED calendar year. The calculator repeatedly reads in three numbers from the standard input that are interpreted as month, day of month, days...
Briefly explain the terms used in object-oriented programming with examples.
Briefly explain the terms used in object-oriented programming with examples.
Classes and Objects are the central of Object Oriented Programming (O.O.P.) This is a style of...
Classes and Objects are the central of Object Oriented Programming (O.O.P.) This is a style of programming that focuses on using objects to design and build many great applications. What is the difference between a class an an instance of the class? Explain what is constructor? What do you call a constructor that accepts no arguments? Explain the "has-a" relationship can exist between classes. Explain what is the "this" keyword? Do the following: Answer the 4 points with only one...
*OBJECT ORIENTED PROGRAMMING* JAVA PROGRAMMING GOAL: will be able to throw and catch exceptions and create...
*OBJECT ORIENTED PROGRAMMING* JAVA PROGRAMMING GOAL: will be able to throw and catch exceptions and create multi-threaded programs. Part I Create a class called Animal that implements the Runnable interface. In the main method create 2 instances of the Animal class, one called rabbit and one called turtle. Make them "user" threads, as opposed to daemon threads. Some detail about the Animal class. It has instance variables, name, position, speed, and restMax. It has a static boolean winner. It starts...
C++In Object Oriented Programming, classes represent abstractionsof real things in our programs. We must...
C++In Object Oriented Programming, classes represent abstractions of real things in our programs. We must quickly learn how to define classes and develop skills in identifying appropriate properties and behaviors for our class. To this end, pick an item that you work with daily and turn it into a class definition. The class must have at least three properties/data fields and three functions/behaviors (constructors and get/set functions don’t count). Do not pick examples from the textbook and do not redefine...
OBJECT ORIENTED PROGRAMMING Design two grid based games or two block based games in c++ In...
OBJECT ORIENTED PROGRAMMING Design two grid based games or two block based games in c++ In some cases, the bulk of the project lies in producing a nice user interface, probably using the FLTK graphical library, while the algorithmic content is quite simple. In other cases, the bulk of the work is in devising and implementing the algorithms. Some projects are more difficult than others, but a good policy is to choose one which allows extensibility if you have more...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT