veronica
veronica

Reputation: 19

Please help me with following the data types

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

Upvotes: 1

Views: 53

Answers (1)

depperm
depperm

Reputation: 10756

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

Upvotes: 2

Related Questions