473,386 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ArrayList is empty.. Need a help

Hi Guys who are online,

Please help me to solve this problem.
Expand|Select|Wrap|Line Numbers
  1. ublic static void ViewFoodTruckInfo() {
  2.         // 1 user wants to view information about food trucks
  3.         // 2 User login with username and password
  4.  
  5.         System.out.println("Enter username : ");
  6.  
  7.         String username = sc.next();
  8.  
  9.         System.out.print("Enter password : ");
  10.         String password = sc.next();
  11.         // Username and password is searched
  12.  
  13.         User foundCust = objCustomer.searchUserByName(username);
  14.         User foundPass = objCustomer.searchUserPassword(password);
  15.  
  16.         // If username and password is correct
  17.         if (foundCust != null && foundPass != null) {  // If the user is a Customer  fullname and email is shown
  18.  
  19.             System.out.println("Name :  " + foundCust.getFullName());
  20.             System.out.println(" Email :" + foundCust.getEmail());
  21.             // Customer selects to view food trucks based on location or foodtype
  22.  
  23.             System.out.println("Do you wants to (V)iew foodTrucks  Or (R)eview foodTrucks : ?  ");
  24.             String input = sc.next();
  25.             if (input.equalsIgnoreCase("V")) {
  26.                 // Customer enter foodtype of location
  27.                 System.out.println("Enter truck Food Type or Location  : ");
  28.                 String stringans = sc.next();    // type or location is searched
  29.                 FoodTruck found = objFoodTruck.FoodTruckByTypeOrLoc(stringans);
  30.  
  31.                 // If location or foodtype matches a FoodTruck
  32.                 if (found != null) {
  33.                     System.out.println("FoodTruck Name  : " + found.getTruckName());  //  found food Truck Average rating and list of review is shown
  34.                     System.out.println("Food Truck Average Rating  :  " + foundCust.getAverageRatings());
  35.                     System.out.println("Food Truck's list of review   : " + found.getListReviewReceived().toString());
  36.  
  37.                 } else {
  38.                     System.out.println("There is no Truck by that foodtype or Location..");
  39.                 }
  40.  
  41.             } else if (input.equalsIgnoreCase("R")) {
  42.                 // method to review
  43.                 ReviewFoodTruck();
  44.  
  45.             } else {
  46.                 System.out.println("You can (V)iew or (R)eview FoodTruck Only!!");
  47.             }
  48.  
  49.         }
  50.  
  51.     }

------------------------------------------------
System.out.println("Food Truck's list of review : " + found.getListReviewReceived().toString());

getListReviewReceived is appearing empty

I have uploaded the whole program. So you guys will be
able to understand my problem.

https://www.dropbox.com/s/01hzol5d728xwmz/BIT203%20Assignment%201.pdf?dl=0

https://www.dropbox.com/s/kh6ecpyp9ghy53y/BIT203%20Assignment%202.pdf?dl=0

https://www.dropbox.com/s/25xo3emf2gidpdf/FTTConsole.zip?dl=0
Nov 29 '16 #1
1 1055
chaarmann
785 Expert 512MB
Your problem: "found.getListReviewReceived()" in line 35 returns an empty object, so that its toString() method prints nothing.
Is that correct?

To be able to analyze the problem, please list the method "getListReviewReceived()" of class "FoodTruck" here.

remarks:
Searching through all your dropbox files is too time consuming for a free helping hand and you have to list it here in the forum anyway, so that others that have the same problem as you can easily see the problem and its solution. Or do you think everybody wants to open dopbox-files (maybe a few years later!) only to see the problem? What if the dropbox vanishes? A broken link is worse. So please do us a favour and list the relevant file here directly.(And please not all the irrelevant files!). If the file is long, then not the whole file, but only the code snippet that has the problem. In this way we can help you best.
Nov 29 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: eLisHa | last post by:
i have an arraylist that gets it's values dynamiclly from the database, after paging, searching & more in the ASP.net file. What im trying to do, is sort the results that are sorted in the...
0
by: Julia | last post by:
I need help with architecture design,please: I have a server which constantly downloading messages from the internet and store them inside a data base. the server have two administrators...
19
by: trint | last post by:
Ok, I start my thread job: Thread t = new Thread(new ThreadStart(invoicePrintingLongRunningCodeThread)); t.IsBackground = true; t.Start(); There are lots of calls to controls and many...
3
by: Julia | last post by:
I need help with architecture design,please: I have a server which constantly downloading messages from the internet and store them inside a data base. the server have two administrators...
2
by: redmond | last post by:
I am implementing pagination using a repeater bound to an ArrayList. The ArrayList has Prev, 1, 2, 3.. Next values. <itemTemplate> <asp:LinkButton id="lnkPages" value=<%(Dictionary.key)%>...
4
by: Learner | last post by:
Hello, Here is a little bit of what I am working ... I have selected Header and Side lay out for my Master Page. All my links go on the Side and the content on to the right pane. I have no...
1
by: rllioacvuher | last post by:
I need help with a program. I have implemented that following header file with an unordered list using one array, but i need to be able to use an ordered list and 2 arrays (one for the links and one...
13
by: =?Utf-8?B?TWFyaw==?= | last post by:
Need help with a variable... This variable is used to keep track of permissions and can contain 1,2,4,8,16,32,64,128 Or it can contain a sum of one more of the above values. For example, if...
4
by: Energizer100 | last post by:
public class fly extends Actor { public fly() { setColor(Color.BLACK); } public fly(Color flyColor) { setColor(flyColor);
5
by: fawwwaz | last post by:
hi all I need help Example: I have 3 list list1 already contains number(Even and Odd) list2 empty list3 empty
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.