1.In solving the given problem above, implement the algorithm you have written in
Activity Sheet 01 using Java as the programming language.
2. In writing your program, create methods to implement the operations identified
in the previous activity. Also, add a constructor that will display a greeting to the
user of the system.
Continuation of this:
https://www.assignmentexpert.com/homework-answers/programming-and-computer-science/algorithms/question-246742
import java.util.Scanner;
public class Main {
String x;
public Main() {//constructor
x = "Hello ";
}
public static void main(String[] args) {
System.out.print("Enter you name: ");
Scanner input=new Scanner(System.in);
String name=input.next();
Main myObj = new Main();
System.out.println(myObj.x+name);
}
}
Comments
Leave a comment