1 Replies - 729 Views - Last Post: 29 August 2011 - 08:57 PM Rate Topic: -----

#1 JGIEG  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-August 11

I am receiving a class, interface, or enum expected error.

Posted 29 August 2011 - 07:03 PM

I am receiving the following error and can not figure it out.
class, interface, or enum expected import java.util.Arrays;

Here is my code:
class SERVER {
	    private String serverTitle;
	    private double serverStock;
	    private double serverPrice;
	    private double serverItem;

	    public SERVER(String title, double stock, double price, double item) {
	        serverTitle = title;
	        serverStock = stock;
	        serverPrice = price;
	        serverItem  = item;
	    } //end four-argument constructor

	    // set SERVER name
	    public void setServerTitle(String title) {
	        serverTitle = title;
	    } //end method  setServerTitle

	    //return SERVER Title
	    public String getServerTitle() {
	        return serverTitle;
	    } //end method getServerTitle
 	    //set SERVER Stock
	    public void setServerStock(double stock) {
	        serverStock = stock;
	    } //end method setServerStock

	    //return ServerStock
	    public double getServerStock() {
	        return serverStock;
	    } //end method get Serverstock

	    public void setServerPrice(double price) {
	        serverPrice = price;
	    } //end method setServerPrice

	    //return serverPrice
	    public double getServerPrice() {
	        return serverPrice;
	    } //end method get Server Price

	    public void setServerItem(double item) {
	        serverItem = item;
	    } //end method setserverItem

	    //return DVD item
	    public double getServerItem() {
	        return serverItem;
	    } //end  method getServerItem

	    //calculate inventory value
	    public double value() {
	        return serverPrice * serverStock;
	    } //end method value

	} //end class SERVER

import.java.util.Arrays;

public class Inventory1 {


	    public static void main(String args []); {

	        SERVER server;


	        server = new SERVER();
	        System.out.println();//skip a line

	         Server[] Server = new Server[5];


			Server[0] = new Server("T-35", 10, 12.50, 1232);
			Server[1] = new Server("T-45", 15, 13.50, 1233);
			Server[2] = new Server("T-55", 5, 15.00, 1234);
			Server[3] = new Server("T-65", 2, 17.00, 1235);
			Server[4] = new Server("T-75", 1, 20.00, 1236);

			for (int count = 0; count < Server.length; count++ ){
				System.out.printf("Server Name is: %\n", Server[count].getServerTitle());
				System.out.printf("Number of units in stock: %.2f\n", Server[count].getServerStock());
				System.out.printf("Price of server: $%4.2f\n", Server[count].getServerPrice());
				System.out.printf("The item number is: %4.2f\n", Server[count].getServerItem());
				System.out.printf("The Value of the inventory is: $%4.2f\n", Server[count].getServer.value());

}
	    } //end main

	} // end class Inventory1


This post has been edited by macosxnerd101: 29 August 2011 - 07:05 PM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: I am receiving a class, interface, or enum expected error.

#2 Fuzzyness  Icon User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: I am receiving a class, interface, or enum expected error.

Posted 29 August 2011 - 08:57 PM

import.java.util.Arrays;
You need to remove the period there, needs to be a space. So it should be:
import java.util.Arrays;

This post has been edited by Fuzzyness: 29 August 2011 - 08:57 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1