Write a complete Java program that prints out the following information:
Note:
Include the screenshot of your code and the output as a part of your answer. Otherwise, you will be marked zero for this question.
Answer: Question Two
The following program supposes to add two numbers and generates the following output.
Sum of these numbers:35
Unfortunately, the program has compile-time and run-time errors that prevent the program from running and producing the correct result. Using the table below, allocate the error(s) on each program line.
1 public class Main {
2 public static Void main(String[] args)
3 int num1 = 10
4 int num1 = 25;
5 int sum;
6 sum = num1 + num2;
7 System.outprintln("Sum of these numbers: "+sum);
8 }
Question 3
Consider the following java class:
class Student { private int student_Number; private String student_Name; public Student(int stNo,String name) { student_Number=stNo; student_Name=name; } public String getName() { return student_Name; } public int getNumber() { return student_Number; } public void setName(String st_name) { student_Name = st_name; } }
Question 4
Consider the following java class:
public class Circle { private double radius; private String color; public Circle(){ radius=0; color = "red"; } public Circle(double r, String c){ radius=r; color = c
} public void setColor(String c){ color = c;
} public double getRadius(){ return radius; } public String getColor(){ return color; } }
Write a Tester class named CircleTester which contains the following instruction: