I need help in this basic java programming. I just need a program that output this according to the original picture above.
Volunteer.java
public class Volunteer {
//instance variables
private String firstName;
private String lastName;
private int hoursAvailable;
//default parameter
public Volunteer()
{
this.firstName = null;
this.lastName = null;
this.hoursAvailable = 0;
}
//constructor with parameters
public Volunteer(String firstName, String lastName, int hoursAvailable)
{
this.firstName = firstName;
this.lastName = lastName;
this.hoursAvailable = hoursAvailable;
}
//getters
//method that returns name
public String getName()
{
return this.firstName+this.lastName;
}
//method that returns hours available
public int getHoursAvailable()
{
return this.hoursAvailable;
}
//setters
//method that sets firstname
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
//method that sets lastname
public void setLastName(String lastName)
{
this.lastName = lastName;
}
//method that sets lastname
public void setHoursAvailables(int hoursAvailable)
{
this.hoursAvailable = hoursAvailable;
}
}
VolunteerTest.java
public class VolunteerTest {
public static void main(String[] args) {
// Use constructors to create an empty volunteer object
// and an object containing data
Volunteer volunteer1 = new Volunteer();
Volunteer volunteer2 = new Volunteer("Bill", "Gates", 5);
//Display the initial values in the objects
System.out.printf("volunteer1 name is : %s%n", volunteer1.getName());
System.out.printf("volunteer1 hours available is : %s%n%n", volunteer1.getHoursAvailable());
System.out.printf("volunteer2 name is : %s%n", volunteer2.getName());
System.out.printf("volunteer2 hours available is : %s%n%n", volunteer2.getHoursAvailable());
//Update the objects
volunteer1.setFirstName("Melinda");
volunteer1.setLastName("Gates");
volunteer1.setHoursAvailables(10);
volunteer2.setHoursAvailables(7);
//Display the update values in the objects
System.out.printf("volunteer1 name is : %s%n", volunteer1.getName());
System.out.printf("volunteer1 hours available is : %s%n%n", volunteer1.getHoursAvailable());
System.out.printf("volunteer2 name is : %s%n", volunteer2.getName());
System.out.printf("volunteer2 hours available is : %s%n%n", volunteer2.getHoursAvailable());
}
}
Output:
Let me know if you have any concerns with the above solution
I need help in this basic java programming. I just need a program that output this...
help fixing this code in JAVA SIC 7 19 11 12 src eclipse-workspace - doublesalary2/src/module-info.java - Eclipse IDE HG2GP Package Explorer X B J "module-info.java X J module-info.java Outline X Assigment 1 @ 1 module doublssalary21 bill import java.util.Scanner; doublosalary2 doublasalary N 4 public class DoubleSalary I DoubleSalary > JRE System Library (JavaSE-14) M 5 public static void main(String[] args) { @ main(Stringni : void 6 Scanner sc = new Scanner(System.in); doublasalary2 System.out.print("Enter number of days: "); 8 ► JRE...
How do I correct this error in my code? When it got to the file type I can only go "null" from a certain point and I'm wondering how to correct this error. Also can I get a word document on this coding strategy for this problem? How much of this am I doing correctly? The original problem description: Create a program that provides a listing of all the files in a directory. The program should be a Java application...
Really need help with this. This is for my Advanced Java Programming Class. If anyone is an expert in Java I would very much appreciate the help. I will provide the code I was told to open. Exercise 13-3 Use JPA to work with the library checkout system In this exercise, you'll convert the application from the previous exercise to use JPA instead of JDBC to access the database. Review the project Start NetBeans and open the project named ch13_ex3_library that's...
Need help with this Java. I need help with the "to do" sections. Theres two parts to this and I added the photos with the entire question Lab14 Part 1: 1) change the XXX to a number in the list, and YYY to a number // not in the list 2.code a call to linearSearch with the item number (XXX) // that is in the list; store the return in the variable result 3. change both XXX numbers to the...
DataSetEmployee Can you please help me the JAVA program? Here is the requirement. Rewrite DataSetBook to be DataSetEmployee. DataSetEmployee should extend ArrayList<Employee> and have no instance variables. You'll have to decide what replaces the getPages concept for getMax/getMin. As a hint, what method of Employee returns a numeric value? Make a package com.acme.midmanager. This package should contain the Manager class. Make a package com.acme.personnel. This package should contain the DataSetEmployee class. Make a package com.acme.topmanagement. This package should contain the...
Input hello, I need help completing my assignment for java,Use the following test data for input and fill in missing code, and please screenshot output. 1, John Adam, 3, 93, 91, 100, Letter 2, Raymond Woo, 3, 65, 68, 63, Letter 3, Rick Smith, 3, 50, 58, 53, Letter 4, Ray Bartlett, 3, 62, 64, 69, Letter 5, Mary Russell, 3, 93, 90, 98, Letter 6, Andy Wong, 3, 89,88,84, Letter 7, Jay Russell, 3, 71,73,78, Letter 8, Jimmie Wong,...
Please Implement this code using Java Eclipse. CIS 1068 Assignment 8 Warm Up with Objects Due: Wednesday, March 25 70 points (+ up to 15 extra credit) The purpose of this assignment is to give you practice implementing your own classes. It also provides extra practice with arrays. Task Implement a class Task, which is used to represent a job that should be done. It should contain the following private fields: .name text description of what job should be done...
Java Programming The program template represents a complete working Java program with one or more key lines of code replaced with comments. Read the problem description and examine the output, then study the template code. Using the problem-solving tips as a guide, replace the /* */ comments with Java code. Compile and execute the program. Compare your output with the sample output provided. Modify class Time2 to include a tick method that increments the time stored in a Time2 object...
I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java Programming Project #4 – Classes and Objects (20 Points) You will create 3 new classes for this project, two will be chosen from the list below and one will be an entirely new class you invent.Here is the list: Shirt Shoe Wine Book Song Bicycle VideoGame Plant Car FootBall Boat Computer WebSite Movie Beer Pants TVShow MotorCycle Design First Create three (3) UML diagrams...
I have Majority of the code written but I just need to implement the <,>,and = sign in the code. I have posted the instructions for the whole code. I will add what I have at the end. Objectives: Implement basic class concepts in Java Implement inheritance with super and sub-classes Implement basic polymorphism concepts Problem: The TARDIS has been infected by a virus which means it is up to Doctor Who to manually enter calculations into the TARDIS interface....