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

This is for C# using Visual Studios Your program 1. must contain a namespace blo

ID: 3889359 • Letter: T

Question

This is for C# using Visual Studios

Your program 1. must contain a namespace block called "Homework 1 2. must contain a class block called "Program" 3. must contain a Main() method (private or public is acceptable) 4. must declare at least one variable each of type: int char, float, string but you can use more than one variable of any type as needed 5. must assign values to all variables that are declared 6. must contain a comment block at the beginning of the file listing a) a short description of the program's purpose i.e. what the program does, b) author's name, c) textable phone number, d) author's email 7. must display at least one line on the console with the program name like: Brett's Quiz1 Program.etc (of course, replace my name with your name) 8. must display on the console the value of all variables like: "3 or "name- Brett, etc. 9. must implement an if--else if-else construct that tests an integer type variable for equality to 1 and display this fact to the console else, if the integer equals 2 display this fact to the console else display to the console that the integer is neither 1 nor 2 10, must implement a switch statement using instructions from #9 above. So, instead ot'ir, use a switch/case block

Explanation / Answer

// program to perform basic display,if and switch operations

//author name

//phone

//email

using System;

namespace Homework1

{

public class Program

{

public static void Main()

{

//variable declarations

int a;

char c;

double f;

string s;

Console.WriteLine("Brett's Quiz1 Program");

//variable initialization

a = 10;

c = 'c';

f = 12.34;

s = "abcd";

Console.WriteLine(" a = "+a);

Console.WriteLine("c = "+c);

Console.WriteLine("f = "+f);

Console.WriteLine("s = "+s);

//if-else if

if(a==1)

Console.WriteLine("a = 1");

else if(a == 2)

Console.WriteLine("a = 2");

else if(a == 10)

Console.WriteLine("a = 10");

//switch statement

switch(a)

{

case 1: Console.WriteLine("a = 1");

break;

case 2: Console.WriteLine("a = 1");

break;

case 10: Console.WriteLine("a = 10");

break;

default: Console.WriteLine("a is not equal to 1,2 or 10");

break;

}

}

}

}

Output:

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