Write a java class called Eventjava representing an event se

Write a java class called Event.java representing an event set up in someone\'s calendar. This class should store three bits of information about the event: What is the title of the event (a String) Where is the event going to take place (a String) What is the date the event is going to take place (a Gregorian calendar() How many hours long is the event (a Double) The Event class should have eight methods set Title(String title) for setting and storing the title of the event String get Title() for returning the title of the event set venue (String venue) for setting and storing the venue of the event String get venue() for returning the venue of the event set Date(Gregorian calendar date) for setting and storing the date of the event String get Date() for returning the date of the event in MM/dd/yyyy set Duration(double duration) for setting and storing the duration in hours of the event double get Duration for returning the length of the event in hours 0 3. Write a java application called Event Test java that lets the user create two Event objects and then prints the following sample output. Enter title of the first event: New Student Welcome Enter venue of the first event: Student Union Building Enter the date of the first event (MM/dd/yyyy): 07/22/2016 Enter duration for first event: 2.5 Enter title of the second event: Job Fair Enter venue of the second event: University Career Center Enter the date of the second event (MM/dd/yyyy):07/26/2016 Enter duration for second event: 6 \"Student orientation\" event will take place on 07/22/2016 for 2.5 hours in Student Union Building \"Job Fair\" event will take place on 07/26/2016 for 6 hours in University Career Center.

Solution

import java.util.*;
class Event{
private String title,venue,date;
private double duration;
public void setTitle( String title){this.title = title;}
public String getTitle(){return title;}
public void setVenue(String venue){this.venue=venue;}
public String getVenue(){return venue;}
public void setDate(String date){this.date=date;}
public String getDate(){return date;}
public void setDuration(double duration){this.duration=duration;}
public double getDuration(){return duration   ;}  
public static void main(String args[]){
Event event1 = new Event();
Event event2=new Event();
Scanner sc=new Scanner(System.in);
//Scanner sc1=new Scanner(System.in);

String title,venue,date,title2,venue2,date2;
double duration,duration2;
System.out.println(\"Enter title of first event:\ \");
title=sc.next();
event1.setTitle(title);
System.out.println(\"Enter venue of first event:\ \");
venue=sc.next();
event1.setVenue(venue);
System.out.println(\"Enter date of first event in format (MM/dd/YYYY):\ \");
date=sc.next();
event1.setDate(date);
System.out.println(\"Enter duration of first event:\ \");
duration=sc.nextDouble();
System.out.println(\"Enter title of second event:\ \");
event1.setDuration(duration);
title2=sc.next();
event2.setTitle(title2);
System.out.println(\"Enter venue of second event:\ \");
venue2=sc.next();
event2.setVenue(venue2);
System.out.println(\"Enter date of second event in format (MM/dd/YYYY):\ \");
date2=sc.next();
event2.setDate(date2);
System.out.println(\"Enter duration of second event:\ \");
duration2=sc.nextDouble();
event2.setDuration(duration2);

System.out.println(   event1.getTitle()+\" event will take place on \"+event1.getDate()+\" for \"+event1.getDuration()+\"hours in \"+event1.getVenue() +\"\ \");
System.out.println(   event2.getTitle()+\" event will take place on \"+event2.getDate()+\" for \"+event2.getDuration()+\"hours in \"+event2.getVenue() +\"\ \");
}
}

 Write a java class called Event.java representing an event set up in someone\'s calendar. This class should store three bits of information about the event: Wh
 Write a java class called Event.java representing an event set up in someone\'s calendar. This class should store three bits of information about the event: Wh

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site