Question

In: Computer Science

1) The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program....

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();
}
}

Solutions

Expert Solution

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 :


Related Solutions

The files provided contain syntax and/or logic errors. In each case, determine and fix the problem,...
The files provided contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. 3. public abstract class DebugBoat {    String boatType = new String();    int passengers    String power = new String();    public FebugBoat(String bt)    {       boatType = bt;    }    public boolean equals(otherBoat)    {       boolean result;       if((passengers == otherBoat.passengers) && (power.equals(otherBoat.power)))          result = true;       else          result = true;       return result    }    public String...
C++ : Find the syntax errors in the following program. For each syntax error, fix it...
C++ : Find the syntax errors in the following program. For each syntax error, fix it and add a comment at the end of the line explaining what the error was. #include <iostream> #include <cmath> using namespace std; int main(){ Double a, b, c; 2=b; cout<<"Enter length of hypotenuse"<<endl; cin>>c>>endl; cout>>"Enter length of a side"<<endl; cin>>a; double intermediate = pow(c, 2)-pow(a, 2); b = sqrt(intermediate); cout<<"Length of other side is:" b<<endline; return 0; }
Part 1: Find and fix errors and add following functionalities 1. There are several syntax errors...
Part 1: Find and fix errors and add following functionalities 1. There are several syntax errors in the code that are preventing this calculator from working, find and fix those errors. When they are fixed, the number buttons will all work, as well as the + (add) and -- (decrement) buttons. a. To find the errors, open up the Developers Tool of the browser and look at the console (F12). Verify the add functionality works. For a binary operator, you...
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. DebugBox.java public class DebugBox { private int width; private int length; private int height; public DebugBox() { length = 1; width = 1; height = 1; } public DebugBox(int width, int length, height) { width = width; length = length; height =...
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Please Fix code and make Copy/Paste avaliable // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 {    public static void main(String[] args)    {       Scanner input = new Scanner(System.in);       int...
In this program, there are 3 bugs and 2 syntax errors. Please identify them! The source...
In this program, there are 3 bugs and 2 syntax errors. Please identify them! The source code is below. The source code is in C: /*------------------------------------------------------------------ File:  CylinderVolume.c  (Lab 3) Author: Gilbert Arbez, Fall 2018 Description: Calculates how the volume changes for different depths               in a horizontal cylinder. ------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <math.h> // Define symbolic constant #define N       50    // number of points to compute #define TRUE    1 #define FALSE   0 // Prototypes void computeDisplayVolume(double, double); /*-------------------------------------------------------------------- Function: main Description:  Gets from the user...
q7.4 Fix the errors in the code (in C) //This program is supposed to scan 5...
q7.4 Fix the errors in the code (in C) //This program is supposed to scan 5 ints from the user //Using those 5 ints, it should construct a linked list of 5 elements //Then it prints the elements of the list using the PrintList function #include <stdio.h> struct Node{ int data; Node* next; }; int main(void){ struct Node first = {0, 0}; struct Node* second = {0, 0}; Node third = {0, 0}; struct Node fourth = {0, 0}; struct...
To earn full credit, program must be free of syntax, run-time, and logic errors; include program...
To earn full credit, program must be free of syntax, run-time, and logic errors; include program comments; use reasonable readable variable names and prompts. To include variables in the input prompt, you must use concatenation character (+). For example: assume you already asked for input of employee's first name and last name (they are stored into variables FirstName and LastName, then use this prompt to ask for employee's weekly hours which includes the employee's full name in the input statement....
q7.1 Fix the errors in the code (in C) //This program should read a string from...
q7.1 Fix the errors in the code (in C) //This program should read a string from the user and print it using a character pointer //The program is setup to use pointer offset notation to get each character of the string #include <stdio.h> #include <string.h> int main(void){ char s[1]; scanf(" %c", s); char *cPtr = s[1]; int i=0; while(1){ printf("%c", cPtr+i); i++; } printf("\n"); }
Python 3 Fix the code so the program reads the file and see if the bar...
Python 3 Fix the code so the program reads the file and see if the bar code was already inputted 3 times if so, it ishows a warning indicating that the item was already tested 3 times Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT