Professional Documents
Culture Documents
Assessment 5
Assessment 5
}
void printMethod() {
System.out.println("The Place name:"+Place);
System.out.println("Date:"+Date);
for(int i=0;i<Cost.length;i++) {
System.out.println(Activities[i]+":"+"Rs."+Cost[i]);
}
}
}
import java.util.Scanner;
public class SummerVacation extends vacation { String
Coursetitle, Onlineplatform;
int Duration;
void getMethod() {
Scanner in = new Scanner(System.in); System.out.print("The
Course title:");
}
void printMethod() {
System.out.println("Course title is:"+Coursetitle);
System.out.println("Online platform:"+Onlineplatform);
System.out.println("Duration is:"+Duration+"hrs");
}
public static void main(String args[]) { vacation ob = new
vacation(); ob.getMethod();
SummerVacation obj = new SummerVacation(); obj.getMethod();
ob.printMethod(); obj.printMethod(); double total = 0;
for(int i=0;i<ob.Cost.length;i++) { total = total+ob.Cost[i];
}
Output:
Executable Code:
package college;
}
public void printMethod() {
System.out.println("Name of the student:" + this.Name);
System.out.println("Registration number of the student:" +
this.RegistrationNumber);
}
}
package college;
package college;
Output:
Result: From the given output window we can see that the given
code executes successfully