Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 3 (Mac Version) 1) Introduction to Methods (with Debugging) In the first part of this lab, we would like to introduce you to methods,

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Lab 3 (Mac Version) 1) Introduction to Methods (with Debugging) In the first part of this lab, we would like to introduce you to methods, parameter passing, and the helpfulness of the Debugger. a) Enter the following program (use Lab3_1 for both the Project and Code File names). This program prints out a corresponding letter grade for a given mark. It uses a method (called MarktoGrade) to determine the letter grade. MarktoGrade takes one integer call by value formal parameter (called mark) and returns a char value that is the letter grade. All of the input and output (except an crror message) is done in Main. There is one syntax error in this program that you will need to fix before it will compile (the error is in the line where the method is called). Please note that there is a text version of this program named Lab3 1.txt (without the line numbers) available in the Labs folder on BlackBoard for copying and pasting. Also, please be aware that the line numbers in the lab exercise may not be the same as the line numbers you see in Visual Studio 1. Using System: 2. public static class Lab3_1 public static void Main() // declare variables int inpMark; string lastName; char grade- 10. ) 13 //enter the student's lant name Console.Write("Enter the last name of the student-> last Name Console.ReadLine(); //enter and validate the mark doi Console.Write("Enter a mark between 0 and 100 > inpMark - Convert.ToInt32 (Console.ReadLine()) while (inpMark OlinpMark>100) 15. " 16 17. 18. 1. using System; 2. public static class Lab3_1 public static void Main() 17 declare variables int inpMark: string last Name char grade 10. 17 enter the student's last name Console.Write("Enter the last name of the student => "); lastName - Console.ReadLine(); enter (and validate the mark do Console.Write("Enter a mark between 0 and 100 => "); inpMark - Convert.ToInt32 (Console.ReadLine()); while (inpMark 100); 1/ Use the method to convert the mark into a letter grade grade MarkToGrade () 22 17 print out the results Console.WriteLine("{0}'s mark of (1) converts to a [2)", lastName, inpark, grade) Console.ReadLine(); 27 28. 30. // Method: MarkToGrade // Parameter mark: call by value parameter to be converted to a letter grade // Returnst the corresponding letter grade public static charMarkToGrade (intark) prod-fleet01-xythos.s3.us-east-1.amazonaws.com/5bBesu c response-content-spolu // Returns: the corresponding letter grade public static char MarktoGrade (int mark) char letterValue; 38. 41 12 // multi-alternative If statement to determine letter grade if (mark > 0 && mark - 50 && mark 60 6G mark 75 66 mark (85) letterValue = 'B': else if (mark > 85 G mark

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

=+ (b) Show that the condition is sufficient as well.

Answered: 1 week ago

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago