473,396 Members | 1,892 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,396 software developers and data experts.

Taking input into an ArrayList

This problem is dealing with array lists. I already created an empty array list of temperatures....How would i go about asking the user if they want to enter daily high and low temperatures.
if "yes": (a) prompt the user to enter a high and a low temperature;
(b) read the temperatures entered;
(c) add a new Temperatures object containing these
temperatures to the end of the ArrayList;
repeat step (2) until user says "no";

I would think that obviously I'd need an if-then-else statement....but I dont kno how to go about it....I would really appreciat the help.
Nov 29 '07 #1
2 2003
r035198x
13,262 8TB
This problem is dealing with array lists. I already created an empty array list of temperatures....How would i go about asking the user if they want to enter daily high and low temperatures.
if "yes": (a) prompt the user to enter a high and a low temperature;
(b) read the temperatures entered;
(c) add a new Temperatures object containing these
temperatures to the end of the ArrayList;
repeat step (2) until user says "no";

I would think that obviously I'd need an if-then-else statement....but I dont kno how to go about it....I would really appreciat the help.
Hi I have renamed your thread into something closer to your problem description(That's how you should name your threads).

For the input have a look at the Scanner class. For the ArrayList bit, Nomad wrote a nice article about how to use them.
Nov 29 '07 #2
sukatoa
539 512MB
<Removed>

Thanks for trying to help but please make sure you are following the site's posting guidelines.
Nov 29 '07 #3

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

Similar topics

7
by: Alex Ting | last post by:
Hi Everybody, I have an issue about deleting an object from an arrayList. I've bounded a datagrid using this code where it will first run through all of the code in loadQuestions() and bind a...
3
by: george r smith | last post by:
I am trying to create an arrayList that contains multiple arrayLists. My code attempt is below. The question I have is how can I get away from creating another pAttribute list than can be added to...
3
by: VM | last post by:
Why is the third line of code in the loop take so long? W/o that line, the execution (35,000 loops) runs in 3 secs. With the line, it goes up to over 5 mins. dataGrid_auditAddress.DataSource =...
4
by: JohnR | last post by:
Assume you have a grocery store application. An order consists of an order header with the "customer" info, and multiple "item" records (one for each thing they ordered). Now, in a regular DB...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
7
by: Monu2301 | last post by:
hello! I am new to java but as compared to any other language like c or c++ taking input in java is difficult but I tried using Keyborad.readInt(); for reading the inputs given by the...
4
by: smitesh | last post by:
Hi friends I m very new for java and i m reading collections right now. I m writing data into a text file and then transfering it in an arraylist. I want the reverse of it, which i am trying n...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.