1

Assuming you belong to the IT department of the compant, and tasked to write a Java program that uses the object-oriented to do the following task:

IT Class:

There will be a class containing (but not restricted to) the following attributes belongs to computer:

Computer ID: 4 characters and/or numbers;

private string computerid; outcome: Computer ID: D001

Processor Speed: Alphanumeric

private (???) speed; outcome: Speed: 3.2GHZ

RAM: Alphanumeric

private (???) ram; outcome: RAM: 512MB

Harddisk: Alphanumeric

private (???) disk; outcome: disk: 80GB

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
veronica
  • 19
  • 2
  • 2
    You need to look what `alphanumeric` means and you'll know what kind of type you need. On the `double` or `float` you might want to read this http://stackoverflow.com/questions/27598078/float-and-double-datatype-in-java – Eric Martinez Jun 08 '15 at 04:04

1 Answers1

2

Alphanumeric should be a string, in this case, that you can compare with a pattern using a regular expression (regex) to make sure it is alphanumeric. Something like this:

String alphanumeric='abc123';
alphanumeric.matches('[a-zA-Z0-9]{1,}'); //true
depperm
  • 10,606
  • 4
  • 43
  • 67