1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Paladinen [302]
3 years ago
5

The program DebugTwo2.cs has syntax and/or logical errors. Determine the problem(s) and fix the program.// This program greets t

he user// and multiplies two entered valuesusing 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);}}
Computers and Technology
1 answer:
Elenna [48]3 years ago
5 0

Answer:

The corrected code is as follows:

using System;

using static System.Console;

class DebugTwo2{

     static void Main(string[] args){

       string name;string firstString, secondString;

       int first, second, product;

       Write("Enter your name >> ");

       name = ReadLine();

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

       firstString = ReadLine();

       first = Convert.ToInt32(firstString);

       Write("Enter another integer >> ");

       secondString = ReadLine();

       second = Convert.ToInt32(secondString);

       product = first * second;

       Write("Thank you, {0}. The product of {1} and {2} is {3}", name,first, second, product);

   }

}

Explanation:

       string name;string firstString, secondString; ----- Replace secondSting with secondString,

<em>        int first, second, product;</em>

       Write("Enter your name >> "); --- Here, the quotes must be closed with corresponding quotes "

       name = ReadLine(); The syntax of readLine is incorrect without the () brackets

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

<em>        firstString = ReadLine();</em>

       first = Convert.ToInt32(firstString); There is a dot between Convert and ToInt32

<em>        Write("Enter another integer >> ");</em>

       secondString = ReadLine(); --- Readline() should be written as ReadLine()

<em>        second = Convert.ToInt32(secondString);</em>

<em>        product = first * second;</em>

       Write("Thank you, {0}. The product of {1} and {2} is {3}", name,first, second, product); --- The formats in {} should start from 0 because 0 has already been initialized for variable name

   }

}

You might be interested in
The point of (18 ,0) lies on​
zysi [14]
This point lies on the x value
4 0
3 years ago
Read 2 more answers
PLS HELP
kvasek [131]

Answer:

informative, discrimiitive,critical thats the order

4 0
3 years ago
What is my gender (I SWEAR IF YOU GUYS ANSWER WRONG)
Aleks [24]

I think your a girl.

6 0
3 years ago
Read 2 more answers
To employ an access key, press and hold down the ____ key as you tap the access key.
Veronika [31]
To employ an access key, press and hold down the Alt key as you tap the access key.
4 0
3 years ago
To add the word "confidential" to the background of a page, users would need to _____.
maxonik [38]
I believe it would be inserting a watermark (B)
8 0
3 years ago
Read 2 more answers
Other questions:
  • A technician is troubleshooting a small network with cable Internet service in which a user is receiving a message in her web br
    15·1 answer
  • in c Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the li
    14·1 answer
  • Objects of the calculator class require no additional information when created. define an object named calc, of type calculator.
    14·2 answers
  • WILL UPVOTE ALL plz
    13·1 answer
  • Working for the Internal Revenue Service is a career in public safety. A. True B. False
    14·1 answer
  • Arrange the steps below to outline what maia needs to do to accomplish this task.​
    9·1 answer
  • Design and implement an algorithm that gets a list of k integar values N1, N2,...Nk as well as a special value SUM. Your algorit
    10·1 answer
  • When writing HTML code, what is meant by 'syntax'?​
    13·1 answer
  • Describe four traditional tehniques for collecting information during analysis.
    11·1 answer
  • Everyone within a company needs to be aware of what data can do to improve business processes and how to make it happen. Which c
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!