Answer to Question #289492 in Java | JSP | JSF for PATRICK

Question #289492

Create a class called Programmer that includes three pieces of information as instance variables – full name (type String), salary (type double) and age (type int). Your class should have a constructor that initializes the three instance variables. Provide a method named printProgrammerDetails that displays programmer's full name, salary and age. Write a test application named ProgrammerTest that demonstrates class Programmers’s capabilities

1
Expert's answer
2022-01-21T13:15:15-0500
class Programmer {
	private String fullName;
	private double salary;
	private int age;


	public Programmer() {
	}


	public Programmer(String fullName, double salary, int age) {
		this.fullName = fullName;
		this.salary = salary;
		this.age = age;
	}
	
	public void printProgrammerDetails () {
		System.out.println("Full name: "+fullName);
		System.out.println("Salary: "+salary);
		System.out.println("Age: "+age);
	}


}


public class ProgrammerTest  {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		Programmer programmer=new Programmer("Peter Smith", 5255, 35);
		programmer.printProgrammerDetails();
	}


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog