Join 131,642 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,288 people online right now. Registration is fast and FREE... Join Now!
I need to develop a program to maintain a list of homework assignments. when an assignment is assigned, add it to the list and when it is completed, remove it. i should be able to keep track of the due date. I should be able to provide the following services: 1. add a new assignment 2.remove an assignment 3. provide a list of assignments in the order they were assigned. 4. find the assignments with the earliest due date.
i am not sure where to start. i need help really bad
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
public class LnkList_prj1 { static Scanner console = new Scanner(System.in);
public static void main (String[] args) { int setLoc, setVal, insLoc, insVal, remLoc; ArrayList numLst = new ArrayList();
for (int i = 1; i < 11; i++) { numLst.add(i); }
System.out.println("Welcome, How are you how is eveything?"); System.out.println("Welcome to the homework assignment program"); System.out.println("Please start the following program");
// System.out.println("---set operation---"); System.out.println("Which element:"); setLoc = console.nextInt(); System.out.println("Which integer value to set to:"); setVal = console.nextInt();
// to insert assignments into the program list System.out.println("\n---insert operation---"); System.out.println("After which element:"); insLoc = console.nextInt(); System.out.println("Which integer value to insert:"); insVal = console.nextInt();
// to remove assignments form the program list System.out.println("\n---remove operation---"); System.out.println("which element:"); remLoc = console.nextInt();
Forgive me, but what you posted was basically a bunch of print methods, no meat. Put some effort into the methods for adding, removing, sorting, and displaying. If you don't understand java code, there should be tutorials in the tutorial section. Basically I want to see just a little more effort and specifics on your trouble.
Forgive me, but what you posted was basically a bunch of print methods, no meat. Put some effort into the methods for adding, removing, sorting, and displaying. If you don't understand java code, there should be tutorials in the tutorial section. Basically I want to see just a little more effort and specifics on your trouble.
Good Luck!
A little rude Stauffski you are usually mode "pedagogic" than that .... Tired ?
Webbyweb I cut and pasted your code... no really error handling but if you put the good values in (int when a int is expected) it works... So for the third times tonigh (in another posts) what is your problem ?
Yeah, no excuses, sorry webbywebg. I don't like it when people get code and paste it from the internet and get the same grades as myself, or go onto a chat forum and try and get someone to code their prog. I guess when your first post has no code, I get very suspicious. The site policy about posting code is right in the post box, hard to miss. This is not to say what you did or didn't do. I guess I don't know enough to judge. I assumed, and you know that when you assume, you make an ass out of yourself.
Let me help you outline the program.
java
import java.util.*;
public class homeworkHelper{ public static main(String[] args){ Scanner reader = new Scanner(System.in); String name, description; Date dueDate; boolean run = true;
while(run){ //create a user interface menu here, GUI or command //1.)Show as due //2.)Show as assigned //3.)Add assignment //4.)Remove Assignment //5.)Quit //execute appropriate code, gather necessary data from user if(quit){ run = false; } removeOldDates(); } }
public void addAssignment(String name, String description, Date dueDate){ //Create with the sent data. Set the assigned date as the current date, or, send that info as well }
public void removeAssignment(int index){ //remove assignment from lists at index index }
public String showAsAssigned(){ //return lists in formatted fashion, sorting by assigned date }
public String showAsDue(){ //return lists in formatted fashion, sorting by due date }
public void removeOldDates(){ //remove dates that have passed } }
If you have any questions, don't be afraid to ask. Good Luck!
i am sorry i am not sure what to do. its been awhile since i programmed in java do. i added a array to the program is this right. i complied the file and it say that cannot find symbol symbol : variable quit location: class homeworkHelper if(quit){ ^
CODE
import java.util.*;
public class homeworkHelper{ public static void main(String[] args){ Scanner reader = new Scanner(System.in); String name, description; Date dueDate;
ArrayList numLst = new ArrayList();
for (int i = 1; i < 11; i++) { numLst.add(i); }
boolean run = true;
while(run){ //create a user interface menu here, GUI or command //1.)Show as due //2.)Show as assigned //3.)Add assignment //4.)Remove Assignment //5.)Quit //execute appropriate code, gather necessary data from user if(quit){ run = false; } removeOldDates(); } }
public void addAssignment(String name, String description, Date dueDate){ //Create with the sent data. Set the assigned date as the current date, or, send that info as well }
public void removeAssignment(int index){ //remove assignment from lists at index index }
public String showAsAssigned(){ //return lists in formatted fashion, sorting by assigned date }
public String showAsDue(){ //return lists in formatted fashion, sorting by due date }
public void removeOldDates(){ //remove dates that have passed } }
This post has been edited by webbywebb: 9 Oct, 2008 - 02:12 PM