In: Computer Science
1)
The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program.
Grading
When you have completed your program, click the Submit button to record your score.
// Uses
DisplayWebAddress method three times
using static System.Console;
class DebugSeven1
{
static void Main()
{
DisplayWebAddress;
Writeline("Shop at Shopper's World");
DisplayWebAddress;
WriteLine("The best bargains from around the world");
DisplayWebAddres;
}
public void DisplayWebAddress()
{
WriteLine("------------------------------");
WriteLine("Visit us on the web at:");
WriteLine("www.shoppersworldbargains.com");
WriteLine("******************************");
}
}
2)
The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program.
Grading
When you have completed your program, click the Submit button to record your score.
// Address an envelope
using names and addresses
// stored in two parallel arrays
using static System.Console;
class DebugSeven2
{
static void Main()
{
string[] addressees = {"Ms. Mary Mack", "Mr. Tom Thumb", "Dr.
Seuss"};
string[] addresses = {"123 Main", "456 Elm" "87 Maple"};
for(int x = 0; x < addressees.Length; ++x)
AddressEnvelope(addresses[x], addresses[x]);
}
private static void AddressEnvelope(string person, string
street)
{
WriteLine("To : {0}", person);
WriteLine(" {1}", street);
for(x = 0; x < 30; ++x)
Write("-");
WriteLine();
}
}
Question 1:
DebugSeven1.cs :
// Uses DisplayWebAddress method three times
using static System.Console;
class DebugSeven1//C# class
{
static void Main()//Main() method
{
DisplayWebAddress();//method call
WriteLine("Shop at Shopper's World");
DisplayWebAddress();//method call
WriteLine("The best bargains from around the world");
DisplayWebAddress();//method call
}
public static void DisplayWebAddress()//added static keyword
{
WriteLine("------------------------------");
WriteLine("Visit us on the web at:");
WriteLine("www.shoppersworldbargains.com");
WriteLine("******************************");
}
}
===========================
Output :

==========================================
Question 2:
// Address an envelope using names and addresses
// stored in two parallel arrays
using static System.Console;
class DebugSeven2//C# class
{
static void Main()//Main() method
{
string[] addressees = {"Ms. Mary Mack", "Mr. Tom Thumb", "Dr.
Seuss"};
string[] addresses = {"123 Main", "456 Elm","87 Maple"};
for(int x = 0; x < addressees.Length; ++x)
AddressEnvelope(addresses[x], addresses[x]);
}
private static void AddressEnvelope(string person, string
street)
{
WriteLine("To : {0}", person);
WriteLine(" {0}", street);
for(int x = 0; x < 30; ++x)
Write("-");
WriteLine();
}
}
***************************************
Output :
