Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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  
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; 
}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9451229

Have any Question?


Related Questions in Computer Engineering

Sketch out a simple network management system for ndas what

Sketch out a simple network management system for NDAS. What software and hardware support would you recommend? Be sure you justify the information items collected and reported for this system, as well as your software a ...

Asses the challenges faced by financial managers due to

Asses the challenges faced by financial managers due to changes in the macroeconomic environment and how these impact businesses operations. Emphasize how there are consequences related to changes in strategies and prior ...

We have seen how dynamic arrays enable arrays to grow while

We have seen how dynamic arrays enable arrays to grow while still achieving constant-time amortized performance. This problem concerns extending dynamic arrays to let them both grow and shrink on demand. a) Consider an u ...

A compute the sumnbsps1nbsp 1 2 3 nbsp nbsp 9999 the sum

(a) Compute the sum S1 = 1 + 2 + 3 + . . . + 9999 (the sum of all integers from 1 to 9999). Do not use a program. (b) Compute the sum S2 = 1+3+5+...+9999 (the sum of all odd integers from 1 to 9999). Do not use a program ...

You are required but not limited to turn in the following

You are required, but not limited, to turn in the following source file: Requirements to get full credits in Documentation The assignment number, your name, StudentID, Lecture number(time), and a class description need t ...

Given the following table keynbspand fds repair

Given the following table, key and FDs, REPAIR (RepairInvoiceNumber, RepairDate, RepairCost, RepairEmployeeName, RepairEmployeePhone, SerialNumber, Type, TankCapacity) Candidate Keys: RepairInvoiceNumber, and (RepairDate ...

A software engineering question regarding black-box testing

A Software Engineering question, regarding Black-Box Testing Techniques: Q:- A program computes its output variable T according to the following formula: [ x as in multiply] 1)T = X x 0.2 + Y x 0.4 + Z x 0.4 where X>= 50 ...

Display the manager of the employee with the oldest project

Display the manager of the employee with the oldest project start date (start_date). (This query requires 3 nested queries, start by finding the min start_date from project, then find the emp_id from project where start_ ...

Suppose that the demand curve for tickets to see a football

Suppose that the demand curve for tickets to see a football team play a game is given by Q = 80,000 - 40P and marginal cost is zero. The team's stadium can host 75,000 fans. i) How many tickets would the team sell if it ...

The richter scale is often used to measure the strength and

The Richter scale is often used to measure the strength and potential damage caused by an earthquake. Design and write an algorithm which accepts as input a Richter scale reading and then prints a message indicating the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As