2 3 import java.util.Scanner; 4 5 //Boxer class. 6 public class Boxer { 8 90 10 11 12 13 140 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 510 52 53 54 55 56 57 58 //Constructor for the class public Boxer() { } //Method to get the class of the weight public void WeightClass() { double boxerWeight; //Take the input of the weight from the user System.out.print("\nPlease enter the weight of the boxer: "); //Take the input Scanner = new Scanner(System.in); boxerWeight sc.nextDouble(); //Check the class using the weight and display on the console if (boxerWeight >= 105 && boxerWeight <= 115){ System.out.println("\nBoxers weight class is Flyweight"); } else if (boxerWeight >= 116 && boxerWeight <=122) { System.out.println("\nBoxers weight class in Bantamweight"); }else if (boxerWeight >= 123 && boxerWeight <= 130) { System.out.println("\nBoxers weight class in Featherweight"); } else if (boxerWeight >= 131 && boxerWeight <= 140) { else if(boxerweight >= 131 && boxerWeight <= 140) {\ System.out.println("\nBoxers weight class is Lightweight"); } else if (boxerWeight >= 141 && boxerWeight <= 154) { System.out.println("\nBoxers weight class is Welterweight"); else if(boxerWeight >= 155 && boxerWeight <= 168) { } System.out.println("\nBoxers weight class is Middleweight"); else if(boxerWeight >= 169 && boxerWeight <= 200) { System.out.println("\nBoxers weight class is Cruiserweight"); else if (boxerWeight > 200) { System.out.println("\nBoxers weight class is Heavyweight"); } //Main method public static void main(String[] args) { //Create the instance of the Boxer class Boxer boxer = new Boxer(); boxer.WeightClass();

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

code in java

Download the file boxer.java write the code for determining the boxer’s weight class as described in the comments. Compile your code and remove any errors, submit the file named boxer jav

Please use the most SIMPLEST and BASIC method 

i am attaching an image of the code that i used earlier which got rejected and i am putting the statement of the professor here(correct it accordingly)-

not sure you understood how the else keyword works. when u r using the else-if structure for this, you do not need the complex conditions, because you can ONLY get to the code following the else keyword if the previous if condition FAILED, so you do not need to test that condition again.

 

1
2
package DemoPack;
3 import java.util.Scanner;
4
5 //Boxer class
6 public class Boxer {
7
8
90
10
11
912
12
13
140
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
♡ ♡ ♡ auņu ÿ‡wwwwwwwww you
33
34
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
510
52
53
54
55
56
57
58
59}
//Constructor for the class
public Boxer() {
}
//Method to get the class of the weight
public void WeightClass() {
double boxerWeight;
//Take the input of the weight from the user
System.out.print("\nPlease enter the weight of the boxer: ");
}
//Take the input
Scanner
= new Scanner(System.in);
boxerWeight = sc.nextDouble();
//Check the class using the weight and display on the console
if (boxerWeight >= 105 && boxerWeight <= 115){
System.out.println("\nBoxers weight class is Flyweight");
}
else if (boxerWeight >= 116 && boxerWeight <=122) {
System.out.println("\nBoxers weight class in Bantamweight");
}else if (boxerWeight >= 123 && boxerWeight <= 130) {
System.out.println("\nBoxers weight class in Featherweight");
}
else if (boxerWeight >= 131 && boxerWeight <= 140) {
else if(boxerweight >= 131 && boxerWeight <= 140) {
}
System.out.println("\nBoxers weight class is Lightweight");
else if(boxerWeight >= 141 && boxerWeight <= 154) {
System.out.println("\nBoxers weight class is Welterweight");
}
else if (boxerWeight >= 155 && boxerWeight <= 168) {
}
System.out.println("\nBoxers weight class is Middleweight");
else if(boxerWeight >= 169 && boxerWeight <= 200) {
}
System.out.println("\nBoxers weight class is Cruiserweight");
else if (boxerWeight > 200) {
System.out.println("\nBoxers weight class is Heavyweight");
}
}
//Main method
public static void main(String[] args) {
//Create the instance of the Boxer class
Boxer boxer new Boxer();
boxer.WeightClass();
Transcribed Image Text:1 2 package DemoPack; 3 import java.util.Scanner; 4 5 //Boxer class 6 public class Boxer { 7 8 90 10 11 912 12 13 140 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ♡ ♡ ♡ auņu ÿ‡wwwwwwwww you 33 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 510 52 53 54 55 56 57 58 59} //Constructor for the class public Boxer() { } //Method to get the class of the weight public void WeightClass() { double boxerWeight; //Take the input of the weight from the user System.out.print("\nPlease enter the weight of the boxer: "); } //Take the input Scanner = new Scanner(System.in); boxerWeight = sc.nextDouble(); //Check the class using the weight and display on the console if (boxerWeight >= 105 && boxerWeight <= 115){ System.out.println("\nBoxers weight class is Flyweight"); } else if (boxerWeight >= 116 && boxerWeight <=122) { System.out.println("\nBoxers weight class in Bantamweight"); }else if (boxerWeight >= 123 && boxerWeight <= 130) { System.out.println("\nBoxers weight class in Featherweight"); } else if (boxerWeight >= 131 && boxerWeight <= 140) { else if(boxerweight >= 131 && boxerWeight <= 140) { } System.out.println("\nBoxers weight class is Lightweight"); else if(boxerWeight >= 141 && boxerWeight <= 154) { System.out.println("\nBoxers weight class is Welterweight"); } else if (boxerWeight >= 155 && boxerWeight <= 168) { } System.out.println("\nBoxers weight class is Middleweight"); else if(boxerWeight >= 169 && boxerWeight <= 200) { } System.out.println("\nBoxers weight class is Cruiserweight"); else if (boxerWeight > 200) { System.out.println("\nBoxers weight class is Heavyweight"); } } //Main method public static void main(String[] args) { //Create the instance of the Boxer class Boxer boxer new Boxer(); boxer.WeightClass();
import java.util.Scanner;
public class Boxer {
public Boxer() {
}
public void weightClass() {
//Ask and receive from the user a weight
}
//Determine the boxer's weight class using the following
/* WEIGHT
CLASS
*
105-115
116-122
123-130
* 131-140
141-154
155-168
169-200
over 200
*
*
*
*/
Flyweight
Bantamweight
Featherweight
Lightweight
Welterweight
Middleweight
Cruiserweight
Heavyweight
☆
//Display the weight class
Transcribed Image Text:import java.util.Scanner; public class Boxer { public Boxer() { } public void weightClass() { //Ask and receive from the user a weight } //Determine the boxer's weight class using the following /* WEIGHT CLASS * 105-115 116-122 123-130 * 131-140 141-154 155-168 169-200 over 200 * * * */ Flyweight Bantamweight Featherweight Lightweight Welterweight Middleweight Cruiserweight Heavyweight ☆ //Display the weight class
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY