Saad_Devin_debugfixifstmt.doc

docx

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

-230

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

3

Uploaded by BaronMoon7849

Report
IT 230 Coding Activity Submission Template Name: Devin Saad Date: 11/16/2023 Class: IT 230 Module: 04
1 . Insert a copy of your of the ZIP file of all of your Visual Studio project files here so that it can be loaded and run in another Visual Studio: Insert here a copy of your *.cs source code text you used here (copy and paste source code here, do not simply insert *.cs files): using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DebugFixIFStmt { class Program { static void Main( string [] args) { ( new Program()).run(); } void run() { int firstChoice = 0, secondChoice = 0, thirdChoice = 0; System.Console.WriteLine( "Teacher's Copy" ); firstChoice = 0; secondChoice = 0; thirdChoice = 0; WriteCurrentChoices(firstChoice, secondChoice, thirdChoice); firstChoice = 2; secondChoice = 0; thirdChoice = 0; WriteCurrentChoices(firstChoice, secondChoice, thirdChoice); firstChoice = 2; secondChoice = 5; thirdChoice = 0; WriteCurrentChoices(firstChoice, secondChoice, thirdChoice); firstChoice = 2; secondChoice = 5; thirdChoice = 7; WriteCurrentChoices(firstChoice, secondChoice, thirdChoice); } void WriteCurrentChoices( int firstChoice, int secondChoice, int thirdChoice) { if (firstChoice == 0) // FIXED: ERROR wrong parameter was "secondChoice" Console.WriteLine( "Choices are: {0}, {1}, {2} => There are no choices yet" , firstChoice, secondChoice, thirdChoice); else if (secondChoice == 0) // FIXED: ERROR Boolean operator (Missing aditional "=") Console.WriteLine( "Choices are: {0}, {1}, {2} => Currently choices are {0}" , firstChoice, secondChoice, thirdChoice, firstChoice); else if (thirdChoice == 0) // FIXED: ERROR had three equal signs "===" Console.WriteLine( "Choices are: {0}, {1}, {2} => Currently choices are {0}, {1}" , firstChoice, secondChoice, thirdChoice, firstChoice, secondChoice); else // FIXED: ERROR uneeded else if statement only needed else to run statements below Console.WriteLine( "Choices are: {0}, {1}, {2} => Currently choices are {0}, {1}, {2}" , firstChoice, secondChoice, thirdChoice, firstChoice, secondChoice, thirdChoice); } } } 2 Insert a screenshot here of the output that resulted from running your program, showing your
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help