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
The Knowledge Consistency Checker (KCC) ensures the maximum number of hops between any two domain controllers does not exceed wh
Katarina [22]

Answer:

Three (3)

Explanation:

Explanation of the three basic terms here - Knowledge consistency checker, hops and domain controller - will give a clearer answer and explanation to the question as follows;

<em>Domain controller</em> : is a server controller that gives access or controls to users on computer networks by first responding to their authentication requests and verifying those users. In other words, a domain controller is a network security manager.

<em>Hop</em> : A hop is simply the passage of data packets from one network to another. As  a packet moves from its source to destination, it moves from router to router. The number of such routers that the packet passes through is called a hop.

<em>The Knowledge Consistency Checker (KCC)</em> :  It is the job of the KCC to ensure that these domain controllers participate in the replication promptly and orderly. Replication means copying data from one location to another (within a network or among networks). The KCC ensures that the maximum number of hops permitted is does not exceed 3. i.e no domain controller is more than 3 hops from any other domain controller within a network.

Note: Replication is of two types - intrasite (among all domain controllers within a site) and intersite (among all domain controllers in different sites), and the KCC can manage both type of replication. Also, by default, at every 15 minutes interval, a domain controller generates a replication topology (a logical map that dictates the domain controllers that will replicate with each other).

<em>Hope this helps!</em>

3 0
3 years ago
Which is the best method of marketing a game to casual players?
Phoenix [80]
A casual game is a video game targeted at or used by casual gamers. Casual games may exhibit any type of gameplay or genre. They are typically distinguished by simple rules and by reduced demands on time and learned skill, in contrast to more complex hardcore games. They typically impose low production and distribution costs on the producer. Casual games are often played on a personal computer online in web browsers, but are also popular on game consoles and mobile phones.

Hope this helped. Have a great day! :D
3 0
3 years ago
Read 2 more answers
List any 5 Unix commands with their brief description?
AlexFokin [52]

Answer:

Commands: commands are also known as "programs" and the program is a set of rules that performs a specific task which is executed by a computer.

Unix is an operating system. that supports multi-tasking and multi-user functionality. Unix is most widely used in all forms of computing systems such as desktop, laptop, and servers. It provides a Graphical user interface similar to windows.

The Unix operating system there are various commands. The list of five Unix commands can be given as:

1) cal

2) date

3) banner

4) who

5) whoami

1)cal:

The cal command stands for calender. It displays the date.

Syntax:

$ cal

or

$ cal [[month] year]

Example:

$ cal 10 2019

2)date:

The date command stands for date and time. It displays the system date and time.

Syntax:

$date

or

$ date[+format]

Example:

$ date +%d/%m/%y

3) banner

The banner command stands for display the text in to a large size.

Syntax:

$banner message

Example:

$banner Unix

4) who

The who command stands for display the list of users currently logged in.

Syntax:

$who

or

$who [option] … [file][arg1]

Example:

$who

5) whoami

The whoami command stands for display the user id of the currently logged-in user.

Syntax:

$whoami

Example:

$whoami

Explanation:

1)cal command display the current month and year.

2)date command display system date and time.

3)banner command display text in large size.

4)who command display the user name who currently login.

5)whoami command display user id.

4 0
3 years ago
Disk ________ realigns separated data so that related file pieces are unified.
PilotLPTM [1.2K]
Disk defragmentation realigns separated data so that related file pieces are unified. <span> Defragmentation is is the process of consolidating fragmented files on the user's hard drive.</span>This Microsoft Windows utility includes <span>rearranging the fragments and restoring them into fewer fragments or into the whole file.
</span>
4 0
3 years ago
Who is the author of computer programming pdf
mash [69]
Donald Knuth<span> began the project, originally conceived as a single book with twelve chapters, in 1962.</span>
5 0
4 years ago
Other questions:
  • Write statementsto show how finding the length of a character array char [ ] differs from finding the length of a String object
    9·1 answer
  • Write a Temperature class that will hold a temperature in Fahrenheit, and will provide methods to get and display the temperatur
    5·1 answer
  • Was the big blue button thing a good decision or bad?<br> *I think it was a bad idea.
    15·2 answers
  • How does an agile team maintain requirement?​
    9·2 answers
  • Programming assignment (100 pts): In the C++ programming language write a program capable of playing Tic-Tac-Toe against the use
    14·1 answer
  • Write a string class. To avoid conflicts with other similarly named classes, we will call our version MyString. This object is d
    5·1 answer
  • When we code an algorithm, we need to provide the commands in the order we want the
    10·1 answer
  • Sypherpk is good go sub 2 him
    6·2 answers
  • TOT al<br>Name TWO examples of these settings and utilities. (2)​
    12·1 answer
  • The Ocean Medallion is a wearable device that connects virtually to various devices on board a cruise ship. When a guest is wear
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!