f



Help in codes please

Hi, can someone please help me code this???=20

Gadget class has four attributes, which correspond to the model,=20

- The price (in pounds)
- The weight (in grams)
- The size (e.g. =E2=80=9C71mm x 137mm x 9mm=E2=80=9D) respectively


The price is a decimal number
- The weight is an integer
- The model and the size are strings of text

Each attribute is initialized in the constructor, by being assigned the val=
ue of one of the constructor's four parameters, and each attribute has a co=
rresponding accessor method.=20

A display method will output (suitably annotated) the model, the price, the=
 weight and the size.

Please someone help me.=20

THANK YOU SO MUCH
0
kainattshafiq90
12/11/2016 12:27:39 AM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

2 Replies
182 Views

Similar Articles

[PageSpeed] 13

On Sat, 10 Dec 2016 16:27:39 -0800, kainattshafiq90 wrote:

> Hi, can someone please help me code this???
> 
> Gadget class has four attributes, which correspond to the model,
> 
> - The price (in pounds)
> - The weight (in grams)
> - The size (e.g. “71mm x 137mm x 9mm”) respectively
> 
> 
> The price is a decimal number - The weight is an integer - The model and
> the size are strings of text
> 
> Each attribute is initialized in the constructor, by being assigned the
> value of one of the constructor's four parameters, and each attribute
> has a corresponding accessor method.
>
This looks like Java 101 homework. However, it seems that you've not made 
any attempt to help yourself yet, so:

- Read your Java language manual.
- Write code that you think should answer the problem.
- Compile it. Test it.
- If it doesn't work and you don't understand why, show us your code
  and ask again.

Hints:

Make sure you add a toString() method to your homework class so you can 
see whether its constructor did what you expect.

Write a test program. This must have a main() method that creates an 
instance of your homework class, calls its toString() method and displays 
the result.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |
0
Martin
12/11/2016 10:00:17 AM
What have you tried so far?
What is the specific difficulty you have?
With respect to your specific difficulty, what in the documentation is failing to help, and why?

HTH,
Lew
0
lewbloch
12/11/2016 4:54:56 PM
Reply: