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
Anarel [89]
3 years ago
15

Debug the code in the starter file so if functions as intended and does not cause any errors. This program is intended to take t

wo integer inputs and determine whether the second is a multiple of the first or not.
the number B is a multiple of the number A if B can be divided by A with no remainder. Remember though that no number can by divided by 0- so no numbers should be considered a multiple of 0 for the purpose of this exercise.


/* Lesson 5 Coding Activity Question 2 */
import java.util.Scanner;
public class U3_L5_Activity Two{
public static void main(string[] args) {
Scanner scan = new Scanner(System.in);
system.out.println("Enter two numbers");
int a = scan.nextInt(;
intb scan.nextInt();
if(b% a = 0 || a
OD
system.out.println(b + " is not a multiple of " + a);
else
system.out.println(b + is a multiple of " + a);
10
}
}
Computers and Technology
1 answer:
Paladinen [302]3 years ago
7 0

Debugging a code involves finding and fixing the errors in a code.

The errors in the code are as follows:

  • <em>Class name</em>
  • <em>Print statements</em>
  • <em>Variable declarations</em>
  • <em>Input statements</em>
  • <em>If condition</em>

<em><u /></em>

<u />

<u>The class name </u>

The class name of the program is <em>U3_L5_Activity Two</em>

A class name cannot <em>contain space</em>; instead you make use of an <em>underscore.</em>

So, the correct class name is: <em>U3_L5_Activity_Two or U3_L5_ActivityTwo</em>

<u>The print statement</u>

Java differentiates lower and upper case letters.

The print statements in the program begin with a <em>small letter s</em>. This is wrong

So, the correct statements are:

  • <em>System.out.println("Enter two numbers");</em>
  • <em>System.out.println(b + " is a multiple of " + a);}</em>
  • <em>System.out.println(b + " is not a multiple of " + a);</em>

<u />

<u>The declaration and the input statements</u>

Variables a and b were declared wrongly, and the input statements are also wrong.

The correct statements are:

  • <em>int a = scan.nextInt(); </em>
  • <em>int b = scan.nextInt(); </em>

<em />

<u>The condition</u>

The if condition is not properly formatted.

The correct statement is: <em>iif(b%a == 0)</em>

Hence, the correct code is:

<em>import java.util.Scanner; </em>

<em>public class Main{ </em>

<em>public static void main(String[] args) { </em>

<em>    Scanner scan = new Scanner(System.in); </em>

<em>    System.out.println("Enter two numbers"); </em>

<em>    int a = scan.nextInt(); </em>

<em>    int b = scan.nextInt(); </em>

<em>    if(b%a == 0){ </em>

<em>        System.out.println(b + " is a multiple of " + a);} </em>

<em>    else{ </em>

<em>        System.out.println(b + " is not a multiple of " + a); </em>

<em>    } </em>

<em>} </em>

<em>}</em>

<em />

Read more about debugging at:

brainly.com/question/23527739

You might be interested in
Example of analog computer and digital computer ​
Nataliya [291]
Give some famous examples of analog computers. Ans. Some examples are operational amplifiers, mechanical integrators, slide rules, tide predictors, electric integrators, etc. These are in use to solve the problems related to partial differential equations, electronic machines, and also neural networks.(Analog). Examples of a digital electronic computers include the IBM PC, the Apple Macintosh as well as modern smartphones. ... An example of a parallel computation system using the abacus would be a group of human computers using a number of abacus machines for computation and communicating using natural language.(Digital)
4 0
3 years ago
Which three are true about converting tabular, summary, or matrix report to a joined report?Choose 3 answersA.Report formula fie
Maurinko [17]

Answer:

Option B, C, and D is the correct options to the following question.

Explanation:

Because the joined report is that type of report which consists of the different standards of data or custom method types of report, in which user can add new accounts to the joined account or report. The joined reports do not support the display filter to the rows and it also not support the bucket field and the cross filters. So, that's why the following option is true.

3 0
4 years ago
Which of the following is not an operating system? Linux Nexus Mac OS Windows
laila [671]
I belive Nexus is not a Operating system, I am not a pro at knowing all of the operating system.
7 0
4 years ago
In the written Hawaiian language, only 13 letters are used: the five vowels (a,e,i,o, and u), and 8 consonants (h,k,l,m,n,p,w, a
Sergeu [11.5K]

Answer:

see explaination

Explanation:

Code below:

#include"letters.h"

int main()

{

while(1)

{

int input;

//Asks the user to enter 1 or 2 to see if the letter is a consonant

//of vowel.

printf("Enter 1 to check vowel or 2 for consonant:");

//scans inputted number

scanf("%i", &input);

//if the input is 1 then it will ask the user to enter the letter

//they want to test.

if(input == 1)

{

char c;

printf("Enter a character to test if it's a vowel:");

scanf(" %c",&c);

//if it is a vowel, then it will print that the letter is a vowel

if(is_vowel(c))

{

printf("%c is a vowel.\n", c);

}

//if not, then it will print that it isn't a vowel

else

{

printf("%c is not a vowel.\n", c);

}

}

//if the user inputs 2, then it will ask the user for the letter to test if

//it's a consonant or not.

else if(input == 2)

{

char c;

printf("Enter a character to test if it's a consonant:");

scanf(" %c",&c);

//if it is a consonant, then it will print that the letter is a consonant

if(is_h_consonant(c))

{

printf("%c is a consonant.\n", c);

}

//if not, then it will tell the user that it isn't a consonant

else{

printf("%c is not a consonant.\n", c);

}

}

else{

break;

}

}

return 0;

}

See attachment for sample output

4 0
3 years ago
Given a set S = {a1, a2, ..., an} of positive integers (denoting asset values), Set partitioning requires to partition S into tw
mel-nik [20]

Answer:

See the pictures attached

Explanation:

3 0
4 years ago
Other questions:
  • Describe the importance of prioritizing your focus when designing for multiple purpose
    9·1 answer
  • ompetitive intelligence: a. helps managers assess their competition and vendors in order to become more efficient and effective
    9·1 answer
  • Is this a scam pls tell me????????????/
    7·2 answers
  • 7.1 Write statements that create the following arrays: A 100-element int array referenced by the variable employeeNumbers. final
    12·1 answer
  • In a nondatabase, file-oriented environment, data is often partitioned into several disjointed systems with each system having i
    11·1 answer
  • Which of the following ways is NOT one of the ways that the census is
    5·1 answer
  • 1. Why is it important for IT technicians to keep documentation on computers for which they are
    13·1 answer
  • All of the following municipal securities are quoted on a yield basis EXCEPT: A) term bonds. B) secured bonds. C) tax-anticipati
    10·1 answer
  • When is a handrail required for stairs
    12·2 answers
  • Water is constantly in motion.<br> True or false
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!