+ 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

9th Apr 2019, 9:05 PM
Jose Rodriguez
Jose Rodriguez - avatar
13 Respuestas
+ 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.
9th Apr 2019, 9:52 PM
Denise Roßberg
Denise Roßberg - avatar
+ 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.
9th Apr 2019, 10:37 PM
Denise Roßberg
Denise Roßberg - avatar
+ 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
10th Apr 2019, 6:41 PM
zemiak
+ 1
this compiles without errors https://pastebin.com/uMVmVDC8 notice: your TestProject.add() method is not used
11th Apr 2019, 11:02 AM
zemiak
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
9th Apr 2019, 10:18 PM
Jose Rodriguez
Jose Rodriguez - avatar
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) { /* ... */ } }
9th Apr 2019, 10:56 PM
zemiak
0
https://code.sololearn.com/c8sdQQ4aJmed/?ref=app here is the updated code all of it still have error😤
10th Apr 2019, 12:01 AM
Jose Rodriguez
Jose Rodriguez - avatar
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
10th Apr 2019, 12:04 AM
Jose Rodriguez
Jose Rodriguez - avatar
0
*mine
10th Apr 2019, 12:04 AM
Jose Rodriguez
Jose Rodriguez - avatar
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()
10th Apr 2019, 11:48 AM
zemiak
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.
10th Apr 2019, 6:08 PM
Jose Rodriguez
Jose Rodriguez - avatar
0
I will keep working on it thank you for your help
10th Apr 2019, 7:30 PM
Jose Rodriguez
Jose Rodriguez - avatar
0
thank you I see what I did wrong I appreciate all your help
11th Apr 2019, 2:09 PM
Jose Rodriguez
Jose Rodriguez - avatar