Find Jobs
Hire Freelancers

Create a class named Date that stores date values and prints out the date in either a pure numeric format or a name and number format

$30-250 USD

Đã hoàn thành
Đã đăng vào hơn 11 năm trước

$30-250 USD

Thanh toán khi bàn giao
Create a class named Date that stores date values and prints out the date in either a pure numeric format or a name and number format (see sample session for format details). ------------------------------------------------------- [login to view URL] class file · Date objects should store the date in two int instance variables ? day and month, and it should include the String instance variable, error, initialized with null. Implement a 1-parameter Date constructor that receives a dateStr string parameter and performs complete error checking on the given dateStr value. The Date constructor is the entity that’s responsible for date error checking. That way, if a Date object is instantiated and if there are no errors, then you’re guaranteed that the Date object holds a legitimate date value. If any kind of error occurs, change the value of the error instance variable to a non-null string value, using an appropriate concatenation of a string constant, input substring, and/or API exception message. Constructors use the same exception handling rules as methods: In a try block, include the parsing of the month and day substrings and other error-checking logic that will not work if parsing fails. · Take into account the actual number of days in each month, but assume that there are always 28 days in February. · To extract day and month numbers from the given date string, use String’s indexOf method to find the location of the slash character, and String’s substring method to extract month and day substrings from the input string. · Include a method for printing the date with a numeric format. Use the zero-pad flag in a printf method call to get exactly two digits for each month and day. · Include a method for printing the date with an alphabetic format. Include a getError method which returns the value of the error instance variable. ---------------------------------------------------------------------------------------------------------------------- [login to view URL] class file In your driver class, include a loop that repeatedly: · Asks the user to enter a date or “q” to quit. · If the entry is not “q”, instantiate a Date object. · If the error variable is null: o Print the date using numeric format. o Print the date using alphabetic format. Otherwise, print the value of the error variable. ------------------------------------------------------------------------------------------------------------------- Sample Session: Enter a date in the form mm/dd ("q" to quit): 5/2 05/02 May 2 Enter a date in the form mm/dd ("q" to quit): 05/02 05/02 May 2 Enter a date in the form mm/dd ("q" to quit): 52 Invalid date format – 52 Enter a date in the form mm/dd ("q" to quit): 5.0/2 Invalid format - For input string: "5.0" Enter a date in the form mm/dd ("q" to quit): 13/2 Invalid month – 13 Enter a date in the form mm/dd ("q" to quit): 2/x Invalid format - For input string: "x" Enter a date in the form mm/dd ("q" to quit): 2/30 Invalid day – 30 Enter a date in the form mm/dd ("q" to quit): 2/28 02/28 February 28 Enter a date in the form mm/dd ("q" to quit): q
Mã dự án: 3994874

Về dự án

27 đề xuất
Dự án từ xa
Hoạt động 11 năm trước

Bạn muốn kiếm tiền?

Lợi ích khi chào giá trên Freelancer

Thiết lập ngân sách và thời gian
Nhận thanh toán cho công việc
Phác thảo đề xuất của bạn
Miễn phí đăng ký và cháo giá cho công việc
Đã trao cho:
Avatar người dùng
Hi, I'd like to do this project please.
$30 USD trong 0 ngày
5,0 (1079 nhận xét)
7,6
7,6
27 freelancer chào giá trung bình $32 USD cho công việc này
Avatar người dùng
JAVA EXPERT ! I can do it very easily ! Let's do it !
$30 USD trong 0 ngày
4,8 (441 nhận xét)
7,4
7,4
Avatar người dùng
I can help you, please check your pm.
$30 USD trong 1 ngày
4,9 (56 nhận xét)
6,2
6,2
Avatar người dùng
Let expert help you. Check your pm for more details.
$30 USD trong 0 ngày
5,0 (99 nhận xét)
5,6
5,6
Avatar người dùng
Hello Sir, Interested in doing this project. Thanks.
$30 USD trong 0 ngày
5,0 (28 nhận xét)
5,4
5,4
Avatar người dùng
Please give me a chance to do this project. I am sure I can complete it perfectly. Thanks
$30 USD trong 1 ngày
5,0 (53 nhận xét)
5,4
5,4
Avatar người dùng
hi i can complete all the requirements you mentioned Contact if interested
$40 USD trong 2 ngày
4,9 (28 nhận xét)
5,4
5,4
Avatar người dùng
im a senior java programmer,and know the basic date vaildator well ,just let me help you~
$30 USD trong 0 ngày
5,0 (14 nhận xét)
5,0
5,0
Avatar người dùng
Ready to do it. Thanks.
$30 USD trong 0 ngày
4,9 (78 nhận xét)
4,6
4,6
Avatar người dùng
Would be my pleasure to work on this project. Kind regards, Rumen
$35 USD trong 1 ngày
5,0 (23 nhận xét)
4,6
4,6
Avatar người dùng
Hello, Java experts here. The task is very simple and can give complete, well commented code within an hour.
$30 USD trong 0 ngày
4,3 (18 nhận xét)
4,3
4,3
Avatar người dùng
Let expert do it.
$30 USD trong 0 ngày
4,9 (18 nhận xét)
3,7
3,7
Avatar người dùng
Will deliver in 2 hours
$30 USD trong 1 ngày
5,0 (2 nhận xét)
3,0
3,0
Avatar người dùng
I can do this for you.....
$30 USD trong 0 ngày
4,3 (10 nhận xét)
3,5
3,5
Avatar người dùng
Hello, I can complete this task within 2 hours.
$30 USD trong 0 ngày
5,0 (8 nhận xét)
2,9
2,9
Avatar người dùng
Hi sir, let me help you on this. I'm an experienced Web Developer having worked for 4+ years with PHP, Java, Solr/Lucene, Sphinx Search, Smarty, MySQL, SQL Server, ASP, JavaScript, Ajax, JQuery and CSS. Please check your inbox(PMB) for further details about my expertises.
$30 USD trong 2 ngày
0,0 (0 nhận xét)
2,0
2,0
Avatar người dùng
I can do it.
$35 USD trong 0 ngày
0,0 (0 nhận xét)
0,0
0,0
Avatar người dùng
Dear sir I can easily do this job.
$30 USD trong 1 ngày
0,0 (0 nhận xét)
0,0
0,0
Avatar người dùng
I have done your job and sending an attached class file and read me file so that you can check it and award me the project. Check PM for files.
$30 USD trong 0 ngày
0,0 (0 nhận xét)
0,0
0,0
Avatar người dùng
This looks like a homework assignemnet i've done. Let's talk.
$30 USD trong 1 ngày
0,0 (0 nhận xét)
0,0
0,0
Avatar người dùng
I will complete your project according to your requirement and on time.
$30 USD trong 1 ngày
0,0 (0 nhận xét)
0,0
0,0

Về khách hàng

Cờ của UNITED STATES
San Antonio, United States
5,0
9
Phương thức thanh toán đã xác thực
Thành viên từ thg 10 4, 2012

Xác thực khách hàng

Cảm ơn bạn! Chúng tôi đã gửi email chứa đường link để bạn lấy tín dụng miễn phí.
Đã xảy ra lỗi trong khi gửi email của bạn. Hãy thử lại.
Người Dùng Đã Đăng Ký Tổng Số Việc Đã Đăng
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Đang tải xem trước
Đã cấp quyền truy cập vị trí.
Phiên đăng nhập của bạn đã hết hạn và bạn đã bị đăng xuất. Hãy đăng nhập lại.