Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Multi-Language Date Calculator Application in Java
Answered

Project Requirements

Project

Submit a zipped archive containing .java file and .doc file with screenshots. Save the .zip in format: .zip (A0123456.zip). The assignment should be submitted through Moodle.Use provided Main.java file to create Java Application which will prompt user for two dates. The application should calculate the difference in-between the dates provided. The feature of this application is multilanguage support. The application should allow user to make more than one calculation, and should exit when user select 0 in language selection. The application should:

• Create menu for user to choose Language

o English, French, German

• Create prompt for user to select Day, Month and Year

o Use provided String arrays with names
o Months and Days are indexed

? January, Janvier and Januar have index 0

• Repeat the prompt twice

o Date from
o Date to

• Dates must be formatted

o Format: "dd MM yyyy"
o Example: "23 01 2021

• Use provided method to calculate difference in days

o int getDaysBetweenTwoDates(String dateString1, String dateString2)
• Print out the answer in selected Language.

• Repeat while languageSelected != 0.

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
/**
* Create menu for user to choose Language (English, French,
German) Create
* prompt for user to select Day, Month and Year of selected
Language where
* Month and Day is extracted from provided arrays Repeat the
prompt twice, to
* get two dates Dates needs to be formatted in "dd MM yyyy"
like : "23 01 2021
* Use provided method int getDaysBetweenTwoDates(String
dateString1, String
* dateString2) to calculate difference in days Print out the
answer in selected
* Language. Repeat while languageSelected != 0
*/
// TODO Your code starts here :
// example how to iterate static array
for(int i = 0; i < ENGLISH_MONTH_OF_THE_YEAR.length; i++) {
System.out.println(String.format("%d month name in
English is %s", i+1, ENGLISH_MONTH_OF_THE_YEAR[i]));
}
// example for the calculation
int daysBetween = getDaysBetweenTwoDates("23 01 2021", "23 01
2020");
System.out.println("Days: " + daysBetween);
}
private final static String[] GERMAN_MONTH_OF_THE_YEAR = {
"Januar", "Februar", "März", "April", "Mai", "Juni",
"Juli", "August", "September", "Oktober", "November",
"Dezember" };
private final static String[] GERMAN_DAYS_OF_THE_WEEK = { "Montag",
"Dienstag", "Mittwoch", "Donnerstag", "Freitag",
"Samstag", "Sonntag" };
private final static String[] FRENCH_MONTH_OF_THE_YEAR = {
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
"Juillet", "Août", "Septembre", "Octobre", "Novembre",
"Décembre" };
private final static String[] FRENCH_DAYS_OF_THE_WEEK = { "Lundi",
"Mardi", "Mercredi", "Jeudi", "Vendredi",
"Samedi", "Dimanche" };
private final static String[] ENGLISH_MONTH_OF_THE_YEAR = {
"January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November",
"December" };
private final static String[] ÈNGLISH_DAYS_OF_THE_WEEK = {
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday" };
/**
* Calculates days difference between two string dates in "dd MM
yyyy" format
*
* @param dateString1 string date1
* @param dateString2 string date2
* @return int representation of days in between the input dates
*/
private static int getDaysBetweenTwoDates(String dateString1,
String dateString2) {
int days = 0;
SimpleDateFormat myFormat = new SimpleDateFormat("dd MM
yyyy");
try {
Date date1 = myFormat.parse(dateString1);
Date date2 = myFormat.parse(dateString2);
long diff = date2.getTime() - date1.getTime();
days = (int) TimeUnit.DAYS.convert(diff,
TimeUnit.MILLISECONDS);
} catch (ParseException e) {
e.printStackTrace();
}
return Math.abs(days);

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close