Copy and paste the code

Assignment Help Basic Computer Science
Reference no: EM13161105

This lab introduces the logical operators AND, OR, and NOT in a menu driven application program.

  • Copy and paste the code below in a filename LastFirst_lab43.cpp (e.g. DoeJoe_lab43.cpp) and save it in Lab 4 folder.
  • Bring in the LastFirst_lab43.cpp program from the Lab 3 folder.
  • How could you rewrite gpa >= 2.0 in the first if statement using the NOT operator?
  • Could you replace year !='4' in the else if statement with year < 4 or year <= 3? Why or why not?
  • Take a screen shot of the output. Save it in a filename LastFirst_lab43.doc (e.g. DoeJoe_lab43.doc)
  • If you replace
if ( gpa >= 2.0 && year == '4') with if ( gpa >= 2.0 || year == '4') and 
replace else if ( year != '4'|| gpa < 2.0) with 
else if ( year != '4' && gpa < 2.0)  which students 
will graduate and which will not graduate  according to 
this new program? Does this handle 
all cases (i.e., all combinations of year and gpa)? 
  • Take a screen shot of the output. Insert it in LastFirst_lab43.doc.
  • Could you replace else if ( year != '4'|| gpa < 2.0) with the single word else?
  • Take a screen shot of the output. Insert it in LastFirst_lab43.doc.
  • Submit both the revised LastFirst_lab43.cpp and LastFirst_lab43.doc by uploading them here.

The following is the code to be used:

#include <iostream> 
using namespace std; 
int main() 
{ 
char year; 
float gpa; 
cout << "What year student are you ?" << endl; 
cout << "Enter 1 (freshman), 2 (sophomore), 3 (junior),
 or 4 (senior)" << endl << endl; cin >> year; 
cout << "Now enter your GPA" << endl; 
cin >> gpa; 
if (gpa >= 2.0 && year == '4') 
cout << "It is time to graduate soon" << endl; 
else if (year != '4'|| gpa <2.0)
 cout << "You need more schooling" << endl; 
return 0; 
}

Reference no: EM13161105

Store the list''s entries in an instance of linked list

Consider an ADT front list , which restricts insertions, removals, and retrievals to the first item in the list. Define and implement a class for the ADT stack that is a des

Draw an entity-relationship diagram

Draw an entity-relationship diagram that describes the following business environment. Must be done by hand, on paper. Not on the computer and include relationship types, (

Descriptor describes a memory segment

The above segment descriptor describes a memory segment in terms of its start address, its size and whether it is ALLOCATED or FREE. This descriptor is part of a list (conta

Find the after-tax rate of return

Find the after-tax rate of return for the following offshore platform equipment. The equipment, designed for special jobs, will cost $2,500, will have no salvage value, and wi

Write all sql statements necessary to redesign this database

Write all SQL statements necessary to redesign this database so that it has just one table. Explain the difference between the result of Project Question 8.51 and the result

Create a world with a right hand holding a toy ball

Create a world with a right hand (People) holding a toy ball (Sports). Have the fingers close to grasp the ball. Then, throw the ball into the air while opening the fingers

How long does it take for the counter to wrap around

To make the initial sequence number a random number, most systems start the counter at 1 during bootstrap and increment the counter by 64,000 every half second. How long doe

Physical characteristics and moisture content

Explain how the different physical characteristics and moisture content of soil lead to the different angles of repose, swell, and shrinkage factors. Explain how these facto

Reviews

Write a Review

 
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