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

Build or buy and service-level agreements

Suppose, as a Chief Information Officer (CIO), you were asked to provide the organization with time-entry system for the employees. Examine the options to insource or outsou

Find the amount of heat transfer in the regenerator

Air enters the compressor of a regenerative gasturbine engine at 310 K and 100 kPa, where it is compressed to 900 kPa and 650 K. The regenerator has an effectiveness of 80 p

Define a function sum-define a function product

1. If m and n are integers, define a function sum (m, n) is the sum of all integers in the interval (m.n), which is 0 if the interval is empty. 2. If m and n are integers,

National center for health statistics

According to the National Center for Health Statistics, in 1990, 28 %of babies in the United States were born to parents who were not married. Throughout the 1990s, this inc

Explore and estimate software programs

Explore and estimate software programs based on following criteria: Needs assessment -- Why would the prospective user require program? Write down the features of the program?

How to build a secure virtual network

This report is based on the concept of virtual network. Today various new technologies have been introduced to fulfill various requirements of the users. As much as technolo

Interpretations of the nessus report

For this Assignment, write a 4- to 6-page paper that summarizes your interpretations of the Nessus report and your recommendations to address the reported vulnerabilities. C

Determine various measures of variability

Research Find the number of students attending each school in your county. Make a box-and-whisker plot of the data. Determine various measures of variability and discuss the

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