الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

[مخالف - طلب حل : ]ممكن مساعده بليز يا مبرمجين

مغلق
بدأه سلطانه في 15 فبراير 2014 · 3 رد · 527 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Create a class called Date that includes three pieces of information as instance variables—a month (type int),a day (type int) and a year (type int). Your class should have a constructor that initializes the three instance variables and assumes that the values provided are correct. Provide a set and a get method for each instance variable. Provide a method displayDate that displays the month, day and year separated by forward slashes(/). Write a test application named DateTest that demonstrates class Date’s capabilities.

ممكن مساعدتي في حل ها لسؤال

−1
#2

بليز احتاج حله بأسرع وقت اذا تكرمتوا علي

−1
#3

public class Date {

private int year, month, day;

public Date(int year, int month, int day) {

//make sure month is not bigger than 12 and day 31

if (month > 12) {

this.month = 12;

} else if (month < 1) {

this.month = 1;

}else{

this.month = month;

}

if (day > 31) {

this.day = 31;

} else if (day < 1) {

this.day = 1;

}else{

this.day = day;

}

//fix for february

if (month == 2 && day > 29) {

this.day = 29;

}

this.year = year;

}

void setDay(int d){

this.day = d;

}

void setMonth(int m){

this.month = m;

}

void setYear(int y){

this.year = y;

}

int getDay(){

return this.day;

}

int getMonth(){

return this.month;

}

int getYear(){

return this.year;

}

String getDateString(){

return this.year+"/"+this.month+"/"+this.day;

}

public static void main(String[] args){

Date d = new Date(1990,12,01);

System.out.println(d.getYear());

System.out.println(d.getMonth());

System.out.println(d.getDay());

System.out.println(d.getDateString());

}

}

−2
#4

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته.

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات، فقرة طلب حل الواجبات والتمارين.

قواعد طرح المشاركات

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

vVIfFr.gif

مدونتي



إذا رأيتموني غبت فأطلت الغياب فربما أكون قد انتقلت عن الدنيا إلى الآخرة

فما أحوجني إلى دعوة صالحة من أخ لي كريم

 

http://www.tvquran.com/

 

LoGeCom

أول برنامج عربي للمحاسبة والتجارة وإدراة المخازن يعمل على اللينكس والماك والويندوز 

هذا الموضوع مغلق.

مواضيع مشابهة