2019FA-CSIS-293-900 X
Debugging Exercise 4- X
Mind Tap - Cengage Le X
Create A Class Named
ng.cengage.com/static/nb/ui/evo/index.html?deploymentid=5847112314511669191043955582&elSBN=9781337397094&i... a
x +
S
f Welcome to Faceb...
Paused
e
chrome://newtab
G Google
E Arabic Keyboard...
مدرسة الحب 4
mirna
Facebook
Welcome to Gros...
>>
Other Bookmar
la
<
CENGAGE MINDTAP
Q Search this course
Debugging Exercise 4-3
Fome
Instructions
DebugBox.java
DebugFour3.java
+
Termin
ses
NLIMITED
se Catalog
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.
er Offers
Options
Grading
e Success
Center
(
Write your Java code in the area on the
right. Use the Run button to compile and
run the code. Clicking the Run Checks
button will run pre-configured tests against
your code to calculate a grade.
1 public class DebugBox
2 {
3 private int width;
4. private int length;
5 private int height;
6 public DebugBox()
7 {
8
length = 1;
9
width = 1;
10 height = 1;
11 }
12 public DebugBox(int width, int length, height)
13 {
14
width = width;
15
length = length;
16
height = height;
17 }
18 public void showData()
19 {
20 System.out.println("Width: + width + Length:
21
length + Height: "+ height);
22 }
23 public double getVolume()
24 {
25
double vol = length + wdth + height;
26
return vol;
27 }
28 }
29
eedback
Once you are happy with your results, click
the Submit button to record your score.
!
+
11
flicts with
G Google
Arabic Keyboard...
مدرسة
mirna
ceb... chrome://newtab
Y
+
2000K
CENGAGE MINDTAP
Programming Exercise 3-4A
+
NumbersDemo.java
>
Instructions
!!!
Create an application named NumbersDemo
whose main() method holds two integer
variables. Assign values to the variables.
5
In turn, pass each value to methods named
displayTwiceTheNumber()
displayNumberPlusFive(), and
displayNumberSquared).
1. public class NumbersDemo {
2. public static void main (String args[]) {
3
// Write your code here
4
}
public static void displayTwiceTheNumber(int n) {
6
// Write your code here
7 }
8 public static void displayNumberPlusFive(int n) {
9
II Write your code here
10 }
11 public static void displayNumberSquared(int n) {
12
// Write your code here
13
14
}
15 ]
Create each method to perform the task its
name implies.
16
Grading
Write your Java code in the area on the
right. Use the Run button to compile and
run the code. Clicking the Run Checks
button will run pre-configured tests against
your code to calculate a grade.
Once you are happy with your results, click
the Submit button to record your score.
Dashboard
x
Discussion/Response 4 x 2019FA-CSIS-293-900 x Debugging Exercise 4- x
MindTap - Cengage Le X
C Create A Class Named
Х
+
Paused
îng.cengage.com/static/nb/ui/evo/index.html?deploymentld=5847112314511669191043955582&eISBN=97813373970948 Q
Apps f Welcome to Faceb... chrome://newtab G Google Arabic Keyboard...
mirna
Facebook Welco e to Gross...
مدرسة الحب
>>
Other Bookmarks
Mirna v
CENGAGE MINDTAP
Q Seth this course
IB
MENU
Debugging Exercise 4-3
My Home
Instructions
DebugBox.java
DebugFour3.java
+
>_ferind
Courses
A-Z
GE UNLIMITED
Browse Catalog
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.
Partner Offers
Print Options
Grading
College Success
n.
Career Center
Write your Java code in the area on the
right. Use the Run button to compile and
run the code. Clicking the Run Checks
button will run pre-configured tests against
your code to calculate a grade.
1 / This class uses a DebugBox class to instantiate two Box objects
2 public class Debug Four3
3 {
4 public static void main(String args[])
5 {
6
int width = 12,
7 length = 10,
8 height = 8;
9
DebugBox box1 = new DebugBox();
10 debugBox box2 = new DebugBox(width, length, height);
11 System.out.println("The dimensions of the first box are");
12 box1.showData;
13 System.out.print(" The volume of the first box is ");
14 showVolume(box1);
15 System.out.println(The dimensions of the second box are");
16
box2.showData();
17 System.out.print(" The volume of the second box is ");
18
showVolume (box2);
19 }
20 public static void showVolume(DebugBox aBox)
21 {
22 double vol = aBox.getVolume();
23 System.out.println(volume);
24 }
25 }
26
Help
Give Feedback
Once you are happy with your results, click
the Submit button to record your score.
- 0
LO
ve Conflicts with
.
E
G Google
H.
Welcome to Faceb... chrome://newtab
Arabic Keyboard...
مدرسة الحب f
mirna
Facebook
Welcome to Gross...
Q Sear
_ Terminal
Tasks
L
displaySalutation() functions as
requested
0.00
out of
10.00
1 public class FormLetterWriter {
2. public static void main(String[] args) {
3
displaySalutation("Kelly");
4
displayLetter();
5
displaySalutation("Christy", "Johnson");
6
display Letter();
7 }
bo
displaySalutation("John")
Unit Test Incomplete
>
9 public static void displaySalutation(String lastName) {
10
// Write your code here
11 }
12
13 public static void displaySalutation(String firstName, String
lastName) {
14
// Write your code here
15 }
16 public static void displayLetter() {
17
// Write your code here
18 }
19 }
20
displaySalutation("Maria")
Unit Test Incomplete
displaySalutation("Greta", "Gerwig")
Unit Test • Incomplete
displaySalutation("Hayao", "Miyazaki")
FormLetterWriter functions as
requested
Run Checks
Submit 0%
+
397094&i...
(G
Q
Faceb... O chrome://newtab G Google E Arabic Keyboard...
h
f
mirna 2 مدرسة الحب f
f Facebook
Welcome to Gross...
CENGAGE MINDTAP
Q Searc
Programming Exercise 4-1
Instructions
FormLetterWriter.java
+
>_ Terminal
+
!!!
2
3
السيارا
1 public class FormLetterWriter {
2 public static void main(String[] args) {
3
displaySalutation("Kelly");
4
displayLetter();
displaySalutation("Christy", "Johnson");
6
displayLetter();
7
}
5
8.
Create a class named FormLetterWriter
that includes two overloaded methods
named displaySalutation() . The first
method takes one String parameter that
represents a customer's last name, and it
displays the salutation Dear Mr. or Ms.
followed by the last name. The second
method accepts two String parameters
that represent a first and last name, and it
displays the greeting Dear followed by the
first name, a space, and the last name. After
each salutation, display the rest of a short
business letter: Thank you for your recent
order.
9
public static void displaySalutation(String lastName) {
10
// Write your code here
11
}
12
13
public static void displaySalutation(String firstName, String
lastName) {
14
// Write your code here
15 }
16 public static void displayLetter() {
17
// Write your code here
18 }
19 }
20
Grading
Write your Java code in the area on the
right. Use the Run button to compile and
run the code. Clicking the Run Checks
button will run pre-configured tests against
your code to calculate a grade.
Once you are happy with your results, click
the Submit button to record your score.
Purchase answer to see full
attachment