The answers of the assignments of Java quizmaster for beginners Teacher's guide by Sar Maroof

The answers of the assignments of Java quizmaster for beginners Teacher's guide by Sar Maroof

Author:Sar Maroof
Language: eng
Format: azw3
Published: 2017-08-29T07:00:00+00:00


Assignment chapter 8

package assignment.calendar;

public class DateInfo

{

private int day = 16;

private int month = 3;

private int year = 1998;

public DateInfo(int day, int month, int year)

{

this.day = day;

this.month = month;

this.year = year;

}

public String getDateFormat()

{

return month + "-" + day + "-" + year;

}

}

package assignment.personal_data;

import assignment.calendar.DateInfo;

public class Student

{

private String name;

private DateInfo birthDate;

public static void main(String[] args)

{

Student isab = new Student();

Student dav = new Student();

DateInfo bdIsab = new DateInfo(28, 8, 1998);

DateInfo bdDav = new DateInfo(13, 9, 1996);

isab.name = "Isabella";

isab.birthDate = bdIsab;

dav.name = "David";

dav.birthDate = bdDav;

System.out.println("---First Student---");

System.out.println("Name: " + isab.name);

System.out.println("Birth date: " + isab.birthDate.getDateFormat());

System.out.println("---Second Student---");

System.out.println("Name: " + dav.name);

System.out.println("Birth date: " + dav.birthDate.getDateFormat());

}

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.