Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need answer for problem 3 please,,, subject covered: switch. Add, symbolic mat

ID: 3812962 • Letter: I

Question

I need answer for problem 3 please,,, subject covered: switch. Add, symbolic math, integral derivatives, curve fitting toolbox. Group names: Farah, Kavita, Nick
Problem 3. Part a. Write a script the prompts the user to enter a name. Using switch case, if the name entered is in your group, the script should display the message: Good guess you got us If the name is not a member of the group display the message: Sorry try again Part b In a new script, create the same outcome using the if else construct. Part c. Compare and contrast the code in part a and b. What do you think was more efficient for this question? If you were creating a script from scratch what are some things, you would think about when deciding whether to use switch case or if else?

Explanation / Answer

public class chegg

{

public static void main()

{

string name ;

system.out.println("enter a name");

switch(name)

case 1: name == "farah"

system.out.println("good guess you got us");

break;

case 2: name == "Kavita"

system.out.println("good guess you got us");

break;

case 3: name == "Nick"

system.out.println("good guess you got us");

break;

default : name == "invalid"

system.out.println("sorry try again");

}

}

part b)

string name ;

system.out.println("enter a name");

if(name == "Kavita" || "Farah" || "Nick")

{

system.out.printl("good guess you got us");

}

else

{

syetem.out.println("sorry try again");

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote