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

Questions Cloud

What is the background information on the environment : what is the background information on the environment.
What maximum pressure in atm could a balloon be filled : used to fill a weather balloon in order to lift equipment into the stratosphere. To what maximum pressure (in atm) could a 271 L balloon be filled?
Describe how uncoupling proteins work : describe how uncoupling proteins work, including their effectson cellular respiration. Explain how these proteins might play a role inthermogenesis and the control of reactive oxygen species such as superoxide.
Explain the process of glycolysis and its role : Can someone please explain the process of glycolysis and its role in cellular respiration?
Copy and paste the code : 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.
In neutrophils what organelle is represented as neutral : In neutrophils what organelle is represented as neutral stainedgranules?
Indicators of measurement and performance : The Concept of a balance scorecard is the topic. While there is not necessarily one best way to view a balance scorecard, clearly the good indicators of measurement and performance go beyond financial perspectives.
State what is the final pressure of the whole system in atm : the third bulb has a volume of 30.0 mL and contains 4.96 atm of hydrogen. If the stopcocks (valves) that isolate all three bulbs are opened, what is the final pressure of the whole system in atm?
What is the purpose of coronary arteries : How would an occlusion in a coronary artery affect blood flow tothe surrounding tissues?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Find out winner in card game

When there is tie, nobody loses. If first two cards total 8 or 9, hand is called a "natural" and it wins automatically, unless both hands have equal value "naturals", in which case it's a tie.

  What influence the concept of pervasive computing

What you believe the eventually influence will be of concept of "pervasive computing" or"location based services" will be on society.

  How many bits are in logical address

Consider a simple paging system with the following parameters: 2^32 bytes of physical memory, page size of 2^10 bytes, and 2^16 pages of logical address space. How many bits are in a logical address?

  Encode audio data in two packets

How might you encode audio (or video) data in two packets so that if one packet is lost, then resolution is simply decreased to what would be expected with half bandwidth?

  Odd-length cycle in directed graph by linear-time algorithm

Give a linear-time algorithm to find an odd-length cycle in a directed graph. You may NOT assume that the graph is strongly connected.

  Explain bec corporate is department

If you were the system analyst in BEC corporate IS department and you had recieved call from Carrie douglas about her Project idea,what would you suggest to Carrie?

  Steps to diagnose application changed from original state

Write down steps would you take in diagnosing the application which has been changed from its original state? Describe the answer.

  Tools or tactics used by risk assessment team

In your new position at XYZ Corporation, you have been asked to lead risk assessment team. How can you bring everyone to agreement an what are there any tools or tactics you might use to help?

  Degree of security in time-shared machine dedicated machine

Write down two such problems? Can we make sure same degree of security in time-shared machine as in dedicated machine?

  Benefits of measures used to protect operating systems

Describe relative benefits and disadvantages of at least three different measures used to protect operating systems.

  Explain chain of custody is critical factor for cases

Think of numerous cases where evidence could potentially be tampered with a cell phone or thumb drive. What can go wrong?

  Local telephone calls and long distance telephone calls

Will the distinction between local telephone calls and long distance telephone calls ever disappear? What may cause this to happen?

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