Remove the break statements from each of the cases

Assignment Help Basic Computer Science
Reference no: EM132254089

How do you add an additional switch statement? i tried multiple times and i'm not sure if i don't understand braces enough but it didn't seem doable. also, I'm not sure what the teacher wants me to submit. This the problem. I'm not sure my code is right or wrong. Please someone explain to me this step by step. I really need help!!

This lab lets students work with the switch statement.

  • Remove the break statements from each of the cases. What is the effect on the execution of the program?
  • Add an additional switch statement that allows for a Passing option for a grade of D or better. Use the sample run given below to model your output.

Sample Run: What grade did you earn in Programming I? 

YOU PASSED!  An A - excellent work!

The following is the code to be used:

// This program illustrates the use of the Switch statement.

// PLACE YOUR NAME HERE

#include <iostream>

using namespace std;

int main()

{

char grade;

cout << "What grade did you earn in Programming I ?" << endl;

cin >> grade;

switch( grade ) // This is where the switch statement begins

{

    case 'A': cout << "an A - excellent work !" << endl;

    break;

    case 'B': cout << "you got a B - good job" << endl;

    break;

    case 'C': cout << "earning a C is satisfactory" << endl;

    break;

    case 'D': cout << "while D is passing, there is a problem" << endl;

    break;           

    case 'F': cout << "you failed - better luck next time" << endl;      

    break; 

    default: cout << "You did not enter an A, B, C, D, or F" << endl;

}

return 0;

}

 

This is my code

 

#include <iostream>

using namespace std;

int main()

{

char grade;

cout << "What grade did you earn in Programming I ?" << endl;

cin >> grade;

switch( grade )

{

   case 'A': cout << " You Passed! " << endl;

   break;

   case 'B': cout << " You got a B - Good Job! " << endl;

   break;

   case 'C': cout << " Earning a C is satisfactory" << endl;

   break;

   case 'D': cout << " while D is passing, there is a problem " << endl;

   break;

   case 'F': cout << " You failed " << endl;

   break;

   default: cout << "You did not enter an A, B, C, D, or F" << endl;

}

return 0;

}

Reference no: EM132254089

Questions Cloud

Turtle graphics to draw the concentric circles : Use turtle graphics to draw the following concentric circles: (1) two circles should be filled with different colors.
Define homeland recovery and continuity of operations : Define Homeland Recovery and Continuity of Operations, including a brief overview (1- or 2-sentence summary) of each of the four phases of COOP.
Why are the commit and rollback statements necessary : Explain their relationship to one of the transaction properties. Explain all four possible concurrency problems and provide examples of each.
Design one or two brands to appeal to each target segment : Design an advertisement for each brand - Design a mountain bike - Design one or two brands to appeal to each target segment, if you have not done so last
Remove the break statements from each of the cases : Remove the break statements from each of the cases. What is the effect on the execution of the program?
What the financial and psychological impacts are : Point out what the financial and psychological impacts are for murder victims or family members. In addition to your speech, you need to create a chart.
Discuss how equifax handled the security incident : Discuss the scope of consumers and businesses affected? Discuss how Equifax handled the security incident.
Selection practices contribute to high performance : How do recruitment and selection practices contribute to high performance in organization?
Do you think national polls impact peoples : Do you pay attention to polls? Do you think national polls impact peoples' views on a topic?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Iscuss why or why not string and array of ints serializable

Discuss why or why not a string and an array of ints are serializable

  Executive brief on writing secure software or j2ee

Create a PowerPoint presentation on Writing Secure Software, or J2EE for your supervisor. Your supervisor wants you to present information to the top level executives as it relates to securing the company's web-based applications that generate rev..

  Computers and electronic communication

What are some ethical issues and dilemmas related to computers and electronic communication?

  Create an alice world with four helicopters

Program the world to make the helicopters each lift off from the ground one at a time, and then all turn and fly away together.

  Similarities and differences between a trojan-virus

Compare and contrast the similarities and differences between a trojan, virus and a worm. In what situation do you think each one might be used for a malicious?

  Write a sequence of statements that creates a new file

There are two text files, whose names are given by two String variables , file1 and file2. These text files have the same number of lines. Write a sequence of statements that creates a new file whose name consists concatenating the names of the tw..

  Outline the sequence of events involved in a plc scan cycle

Compare the way horizontal and vertical scan patterns examine input and output instructions.

  Determining the operations decision

Use the updated demand (QD) and marginal revenue (MR) functions below to complete this assignment.

  Fifo page removal algorithm

Using the FIFO page removal algorithm, indicate the movement of the pages into and out of the available page frames (called a page trace analysis) indicating each page fault with an asterisk (*). Then compute the failure and success ratios.

  Compute the correlation coefficient

Compute the correlation coefficient. Conduct a test of hypothesis to determine if it is reasonable to conclude that the population correlation.

  Organization or organizational resources

A natural consequence of having defined the term "insider" is to consider the term "insider threat". As discussed in the previous section

  Likert scale and the semantic differential scale

Two of the classic approaches to rating scales are the Likert scale and the semantic differential scale.

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