September 09, 2010, 02:11:12 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Need Help for my Assignment Urgently  (Read 2057 times)
0 Members and 1 Guest are viewing this topic.
silence
Junior Member
*

Reputation: 0
Offline Offline
Posts: 9
Referrals: 0

Awards
« on: June 15, 2008, 03:57:12 PM »

Hi all
I need to submit my assignment urgently. Still now I have no idea on that. anyone can help me to finish my assignment. I attached my assignment question as well as my uncompleted answer.

*my programing skill is very bad.
please, help me.
Thank u all.
this is my Question http://www.mediafire.com/?umvrcwwtzy0
this is my answer   http://www.mediafire.com/?iw5myd14cxd
Logged
Javaforums.net :: a community about Java software development.
« on: June 15, 2008, 03:57:12 PM »

 Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #1 on: June 15, 2008, 07:52:54 PM »

So, where you stuck at? What works and what doesn't?
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
silence
Junior Member
*

Reputation: 0
Offline Offline
Posts: 9
Referrals: 0

Awards
« Reply #2 on: June 16, 2008, 03:02:22 AM »

Yeah, i stuck at Option 3, 4 and 5. Option 3, I've already done a bit but i don't know correct or not.

Option 4, I have no idea how to count for No Of Hires( total number of days that each video has been hired is to displayed).

thank you very much.
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #3 on: June 16, 2008, 01:00:35 PM »

Yeah, i stuck at Option 3, 4 and 5. Option 3, I've already done a bit but i don't know correct or not.

Option 3 doesn't do anything so i doubt it's correct
Code
GeSHi (java):
  1. private static ArrayList<Hires> HireList = new ArrayList<Hires> ();
  2. static void LoadHire(){
  3.  
  4. }
Created by GeSHI 1.0.7.20

What you can do is to take the code i wrote in case 5 and change it so that it adds each video that is hired in the HireList Array. Upon entering option 3, use a loop (like you did now) to show the HireList Array.


Option 4, I have no idea how to count for No Of Hires( total number of days that each video has been hired is to displayed).
use the +getDateHired method in Hire and count the difference between the hired date and the current date

Your teacher already hinted you with the method to use:
Code
GeSHi (java):
  1. Hint: The SimpleDateFormat in the java.text package can be used to format the date.
  2. Date today = …
  3. SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
  4. df.format(currentDate);
Created by GeSHI 1.0.7.20

thank you very much.

I've also changed some of the code in your main so you can now add new video's and return to the selection screen:

Code
GeSHi (java):
  1. package videoHiringApplication;
  2.  
  3.  
  4. import java.util.ArrayList;
  5. import java.util.Scanner;
  6.  
  7. public class Main {
  8. static boolean stop = false;
  9. public static void main(String[]args){
  10.  
  11. LoadCustomer();
  12. LoadVideo();
  13. LoadHire();
  14. while(!stop){
  15. LoadMainMenu();
  16.  
  17.  
  18.  
  19. Scanner in = new Scanner(System.in);
  20. int userinput = in.nextInt();
  21. switch(userinput){
  22.  
  23.  
  24. case 1:{
  25. System.out.println("Customer ID\tCustomer Name\tPhone");
  26. for(Customer x: Customers) {
  27. System.out.print (x.getcustomerid() + "\t\t");
  28. System.out.print (x.getcustomername()+ "\t");
  29. System.out.println (x.getphone());
  30.  
  31. }
  32. System.out.println ();
  33. break;
  34. }
  35. case 2: {
  36. System.out.println("ID\tName\t\t\tOnHire");
  37. for(Video x: Videos) {
  38. System.out.print (x.getID());
  39. System.out.print (x.getTitle());
  40. System.out.println (x.getOnHire());
  41. }
  42. break;
  43.  
  44. }
  45. case 3: {
  46. System.out.println("Hire ID\tVideo Name\tCustomer\tDate Hired");
  47. System.out.println("=========================================");
  48. for(Hires x: HireList) {
  49. System.out.print (x.getHireID());
  50. System.out.print (x.getHiredVideoName());
  51. System.out.print (x.getCustomer());
  52. System.out.println (x.getDateHired());
  53.  
  54. }
  55. break;
  56. }
  57. case 4: {
  58. System.out.println("Video ID\tVideo Name\tNo Of Hires");
  59. System.out.println("==================================");
  60. for(Video x: Videos) {
  61. System.out.print (x.getID() + "\t\t");
  62. System.out.print (x.getTitle() + "\t");
  63. //System.out.println (x.NoOfHires());
  64. }
  65. break;
  66. }
  67. case 5:{
  68. String custId;
  69. String videoId;
  70. String hireVideoContinue;
  71.  
  72.  
  73. int j = 0;
  74. boolean hireVideo = true;
  75. Scanner in2 = new Scanner(System.in);
  76. while(hireVideo){
  77.  
  78. System.out.print("Customer Id: ");
  79. custId = in2.nextLine();
  80. for(int i = 0; i < Videos.length; i++){
  81. if(Customers[i].getcustomerid().equals(custId)){
  82. System.out.println(Customers[i].getcustomerid() + Customers[i].getcustomername());
  83. System.out.println("already exist");
  84. }
  85. else{
  86. System.out.print("Video Id ");
  87. videoId = in2.nextLine();
  88. if(Videos[i].getOnHire().equals("Yes")){
  89. System.out.println("Video already hired");
  90. }
  91. else{
  92. for(j = 0; j < Videos.length; j++){
  93. j++;
  94. }
  95. Videos[j+1] = new Video(custId, videoId,"NO");
  96. System.out.println("Video Hired");
  97. break;
  98. }
  99. }
  100. }
  101. System.out.print("Enter another hire [Y/N]?");
  102. hireVideoContinue = in2.nextLine();
  103.  
  104. if(hireVideoContinue.equals("N") || hireVideoContinue.equals("n")){
  105. break;
  106. }
  107. }
  108.  
  109. }
  110. case 6:{
  111. }
  112. case 7: {
  113. System.out.println("exit");
  114. //System.exit(0);
  115. }
  116. }
  117.  
  118. }
  119. }
  120.  
  121.  
  122. public static void LoadMainMenu(){
  123. System.out.println ("MicroVideo Menu");
  124. System.out.println ("================");
  125. System.out.println ("1) List Customers" );
  126. System.out.println ("2) List Videos");
  127. System.out.println ("3) List Hires");
  128. System.out.println ("4) Hire Statistics");
  129. System.out.println ("5) Hire Video");
  130. System.out.println ("6) Return Video");
  131. System.out.println ("7) Quit");
  132. System.out.print ("Enter selection: ");
  133. }
  134. private static Customer[] Customers = new Customer[3];
  135. static void LoadCustomer(){
  136. Customers[0] = new Customer ("C1000" , "Jim Barry", "43484001");
  137. Customers[1] = new Customer ("C1001" , "Jim Barry", "43484001");
  138. Customers[2] = new Customer ("C1002" ,"GeoffreyTan", "43480009");
  139. }
  140.  
  141. private static Video[] Videos = new Video [8];
  142. static void LoadVideo(){
  143. Videos[0] = new Video ("100", "The Matrix 2","NO");
  144. Videos[1] = new Video ("101", "Spiderman 3","NO");
  145. Videos[2] = new Video ("102", "Shrek 2","NO");
  146. Videos[3] = new Video ("103", "The Beach","NO");
  147. Videos[4] = new Video ("104", "Sound of Music","NO");
  148. Videos[5] = new Video ("105", "Planet of the Apes","NO");
  149. Videos[6] = new Video ("106", "Moulin Rouge","NO");
  150. Videos[7] = new Video ("107", "Lord of the Ring 1","NO");
  151.  
  152. }
  153. private static ArrayList<Hires> HireList = new ArrayList<Hires> ();
  154. static void LoadHire(){
  155.  
  156. }
  157.  
  158.  
  159. }
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
Created by GeSHI 1.0.7.20

I could code this entire application myself but i'm quite busy atm so i can only give you hints instead of the entire sourcecode.
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
silence
Junior Member
*

Reputation: 0
Offline Offline
Posts: 9
Referrals: 0

Awards
« Reply #4 on: June 16, 2008, 05:53:54 PM »

HI.. If possible, please kindly give me some more idea or something for Option 3 & 4.
I am just beginner for Java.
I really appreciate for your help and programming skill.
plz, forgive me if i disturb you a lot.
thank you very much.
Logged
silence
Junior Member
*

Reputation: 0
Offline Offline
Posts: 9
Referrals: 0

Awards
« Reply #5 on: June 18, 2008, 03:09:27 AM »

HI...

 I tried my best. But i stuck at Option 5. It did not work properly for Video Rent. Could U check it?
 thank in advance.

my project: http://www.mediafire.com/?2eywxmdwe0b
my question :  http://www.mediafire.com/?umvrcwwtzy0
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #6 on: June 18, 2008, 01:36:13 PM »

I'm a bit busy atm but i can do it in the weekends. Option 5 isn't that difficult.
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #7 on: July 10, 2008, 12:50:42 PM »

I haven't heard from you since, so i guess it's done?
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Javaforums.net :: a community about Java software development.
   

Your Ad Here
 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.519 seconds with 39 queries.

Google visited last this page September 05, 2010, 12:27:17 AM