• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with these two assignments (I have no clue how to do this)  RSS feed

 
T. Ahmed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys , I need major help with these assignments. My classmates won't help so I have no where to turn. Any help will be greatly appreciated. The files are attached below.



Project

Many gas pumps have displays that spin digits (either analog or digital) while the gas is being pumped into your car’s gas tank. The display’s digits change to indicate the amount of gas in the tank and the current price.
Write a program that displays the spinning of the digits. Your GasPumpDisplay class will allow you to create a “gas pump” display with a specified number of display places and will allow you to specify the highest digit in use. You will simplify a gas pump display by using a smaller display of only three digits where the digits are in the limited range of 
0 – 4 inclusive.


Output: GasPumpTester prints the following permutations.

000 001 002 003 004 010 011 012 013 014 020 021 022 023 024 030 031 032 033 034
040 041 042 043 044 100 101 102 103 104 110 111 112 113 114 120 121 122 123 124
130 131 132 133 134 140 141 142 143 144 200 201 202 203 204 210 211 212 213 214
220 221 222 223 224 230 231 232 233 234 240 241 242 243 244 300 301 302 303 304
310 311 312 313 314 320 321 322 323 324 330 331 332 333 334 340 341 342 343 344
400 401 402 403 404 410 411 412 413 414 420 421 422 423 424 430 431 432 433 434
440 441 442 443 444



Assignment 1

Write an algorithm that would find the largest number in an ArrayList of Integers.

Locate the position of the first element that is larger than 100.









 
Liutauras Vilda
Sheriff
Posts: 4922
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

There is no information about where you struggle or what kind of help do you need. In order to help you, you need to help us understand what your difficulties are with this assignment.
Just to be clear from the beginning, most of the work you'd need to do yourself, we are allowed to give you only hints.
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

Another hint: use the remainder operator. Another hint: If you are working in pental arithmetic, your three‑digit display will have 125 different possible values.
Another hint: write down the contents of your numbers List on paper, and then how you would find the largest number without using a computer.
 
T. Ahmed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its okay guys, I literally know nothing from Java, so even with hints I couldn't figure it out. Thanks for helping. I will take an L.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
T. Ahmed wrote: Thanks for helping. I will take an L.


As a side question, what is taking an L? ... edit: Just looked it up on the internet (perhaps, I should have done it first, eh?). I heard of "take a loss", but never heard of "loss" being shortened to "L". Interesting.

edit: back to the original question...

T. Ahmed wrote:Its okay guys, I literally know nothing from Java, so even with hints I couldn't figure it out.


Well, I highly doubt that you know absolutely "nothing". There is no way that that is the first assignment in any course. So, hint: Why can't you use the previous assignment as a template? At minimum, for any classes you create, testing classes, etc.  Additionally, if you provide more details, such as what have you done so far, and what issues that you are running in to, it can give clarification for more hints. Regardless, it can't hurt to try -- versus simply giving up.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!