• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Array References  RSS feed

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me with my mistakes? or rewrite a better one?
vb.jpg
[Thumbnail for vb.jpg]
 
Ana Yo
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:Have you tried typing it in and compiling it? Show some effort.


I wish I could type it in then I wouldn't need to ask but they don't give us the Cellphone and MobilePhone class as shown in the picture. If you would have paid more attention, maybe you would've realized that I can't type it in a computer:)
 
Carey Brown
Saloon Keeper
Posts: 5757
56
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The variable is "phones" not "phone". "phones" is an array. So what type do you get with "phones[i]"?
 
Carey Brown
Saloon Keeper
Posts: 5757
56
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ana Yo wrote:I wish I could type it in then I wouldn't need to ask but they don't give us the Cellphone and MobilePhone class as shown in the picture. If you would have paid more attention, maybe you would've realized that I can't type it in a computer:)

The page you photographed has the Cellphone and MobilePhone class. Am I missing something? Did I miss that you don't have access to a computer with Java installed on it?
 
Ana Yo
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:

Ana Yo wrote:I wish I could type it in then I wouldn't need to ask but they don't give us the Cellphone and MobilePhone class as shown in the picture. If you would have paid more attention, maybe you would've realized that I can't type it in a computer:)

The page you photographed has the Cellphone and MobilePhone class. Am I missing something? Did I miss that you don't have access to a computer with Java installed on it?


They didn't give us all the methods for the two classes, therefore it would be incomplete if I typed it in my laptop, resulting in compile/runtime errors.
 
Carey Brown
Saloon Keeper
Posts: 5757
56
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
 
Sheriff
Posts: 13375
221
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to start with posting the code you're talking about so it's easier to reference specific lines.

You were instructed to complete the ModelsWithALowerPrice method given the code below:

and you wrote as your answer:

Does the above correctly reflect the image you posted?
 
Junilu Lacar
Sheriff
Posts: 13375
221
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to assume that my interpretation of the code shown in the image is correct and also that this was a test where you were not allowed to use a computer but had to write down your code by hand.

This isn't a very well-constructed test question and frankly, I find it a little disappointing to see students being taught and assessed this way. However, there's obviously an answer here that would give you full marks, so let's explore what that answer might be.

The fact that some implementation details are not shown will not prevent you from giving a correct answer to this question.  A reasonable assumption would be this:

The fact that there are other methods of the CellPhone class that are not shown does not prevent you from coming up with a correct answer either. If anything, the comment should make you do some critical thinking which would lead to the conclusion that the comment is irrelevant to the answer.

Edit: I take that back. In fact, the comment is relevant.

Challenge: Can you figure out why it's relevant and what code you'd have to assume was there that isn't shown? There are at least two possible variations of the assumption you can make.
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!