Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROGRAM 1 // Program compares your name to the name of your boss using System; using static System.Console; class DebugTwo1 { static void Main() {

PROGRAM 1

// Program compares your name to the name of your boss

using System;

using static System.Console;

class DebugTwo1

{

static void Main()

{

string name, bossName,

bool areNamesTheSame;

Write(Enter your name >> ");

name = ReadLine();

Write("Hello {0}! Enter the name of your boss >> ", name);

bossName == ReadLine();

areNamesTheSame = String.Equals(name, bossName);

WriteLine("It is {0} that you are your own boss", isNameTheSame);

}

}

PROGRAM 2

// This program greets the user

// and multiplies two entered values

using System;

using static System.Console;

class DebugTwo2

{

static void main()

{

string name;

string firstString, secondSting;

int first, second, product;

Write("Enter your name >> );

name = ReadLine;

Write("Hello, {0}! Enter an integer >> ", name);

firstString = ReadLine();

first = ConvertToInt32(firstString);

Write("Enter another integer >> ");

secondString = Readline();

second = Convert.ToInt(secondString);

product = first * second;

WriteLine("Thank you, {1}. The product of {2} and {3} is {4}",

name, first, second, product);

}

}

PROGRAM 3

// This program computes net weekly pay

// based on hours worked, rate per hour,

// and 15% withholding

using System;

using static System.Console;

class DebugTwo3

{

static void Main()

{

const double WITHHOLDING_RATE = 15;

string hoursAsString, rateAsString;

double hours, rate;

double gross, withholding, net;

Write("Enter the number of hours you worked this week >> ");

hoursasString = ReadLine();

Write("Enter your hourly rate >> ");

rateAsString = ReadLine()

hours = Convert.ToDouble(hoursAsStrinng);

rate = Convert.ToDouble(rateAsStrinng);

gross = hours + rate;

withholding = gross * WITHHOLDING_RATE;

net = gross * withholding;

WriteLine("You worked {0} hours at {1} per hour",

hours, rate.ToString("C"));

WriteLine("Gross pay is {0}", gross.ToString("C"));

WriteLine("Withholding is {0}", withholding.ToString("C"));

WriteLine("Net pay is {0}", netToString("C"));

}

}

PROGRAM 4

// This program tells the user the values of the integers that are

// one more and one less than the entered integer

using System;

using static System.Console;

classDebugTwo4

{

static void Main()

{

string entry;

int enteredInteger;

int more, less;

Write("Enter an integer >> ");

entry = ReadLine();

WriteLine("You entered {0}", entry);

enterdInteger = Convert.ToInt32(entry);

more = enteredInteger + 1;

less = enteredInteger - 1;

WriteLine("One more than (0) is {1} and one less than {2} is {3}",

enteredInteger, more less);

}

}

PLEASE SLOVE THE BUGS IN THESE PROGRAMS.

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

What magazine and ads did you choose to examine?

Answered: 1 week ago