+ 1
Deleted sat and sun
I am trying to get input date from user add 10 business days with out sat and sun. Here is a insert of the error with my code. https://code.sololearn.com/c8sdQQ4aJmed/?ref=app
13 odpowiedzi
+ 2
Line 8: remove } and put it at the end
You need a main method/main class to execute your code.
What is LocalDate? If it belongs to the java api, import it.
+ 2
You need to close your main method, to separate it from your other method
Class{
Main method{
//some code
}
public LocalDate add{
//some code
}
}//end class
Now you only get an error because LocalDate is not found, which is in your other code.
+ 1
import java.time.LocalDate;
import java.time.DayOfWeek;
you have not end of main()
...
} // this
last two lines is out of class, it is wrong
+ 1
this compiles without errors
https://pastebin.com/uMVmVDC8
notice: your TestProject.add() method is not used
0
https://code.sololearn.com/c8sdQQ4aJmed/?ref=app
here is the update but I am still get an error LocalDate is the input form user thats is on the other half of my code
0
import java.time.LocalDate;
import java.time.DayOfWeek;
public class Noweekend{
public static void main(String [] args) {
new Noweekend().run(); //if add() is non-static
}
void run() {
LocalDate today = LocalDate.now();
LocalDate date = add( today, 3);
System.out.println(today +"\n" +date );
}
public LocalDate add(LocalDate date, int workdays) {
/* ... */
}
}
0
https://code.sololearn.com/c8sdQQ4aJmed/?ref=app
here is the updated code all of it still have error😤
0
zemiak, I look at the code but I can’t use today date needs to be user input can I change your code to fit my
0
*mine
0
after last update:
// add end bracket } for main() after line:
cal.setTime(new Date (date.nextLine()));
}
// after it, delete second main() declaration
// public static void main(String [] args) {
// delete word public from result declaration
//public
Date result = date;
// delete or comment two last brackets and two code lines (at end of code)
/* }
}
cal.add(Calendar.DATE, 90);
System.out.println("90 days later: " + cal.getTime());
*/
// then, you changed LocalDate to Date, now you can't call this result methods
// because Date object doesn't have them
result.plusDays()
result.getDayOfWeek()
0
https://code.sololearn.com/c8sdQQ4aJmed/?ref=app
made changes you talk about but error are still in the system... thank you for the help I do appreciate it.
0
I will keep working on it thank you for your help
0
thank you I see what I did wrong I appreciate all your help