We have been given a task to do the following:-

Write a class LectureTheatre that has the following attributes (properties):

lectureTheatreName / maxOccupancy / layoutStyle (the lecture theatre may be either flat or tiered)

For example:-
lectureTheatreName : Frankland LT ... or ... Fylde LT2 ... or ... George Fox LT1
maxOccupancy : 145 ... 45 ... 350
layoutStyle : tiered ... flat ... tiered

- Attributes should be considered to be Strings or integers, as appropriate
- All attributes should be considered to be private to the class
- Include a javadoc comment for each attribute

This is the start of the class - is this going along the right lines? We do not know where to go from here. . .

class LectureTheatre {
    public static void main(String[] arguments) {
		
		private int maxOccupancy;
		private int layoutStyle;
		private String lectureTheatreName;
	
			
		}

		
	}
}

Recommended Answers

All 8 Replies

We have been given a task to do the following:-

Write a class LectureTheatre that has the following attributes (properties):

lectureTheatreName / maxOccupancy / layoutStyle (the lecture theatre may be either flat or tiered)

For example:-
lectureTheatreName : Frankland LT ... or ... Fylde LT2 ... or ... George Fox LT1
maxOccupancy : 145 ... 45 ... 350
layoutStyle : tiered ... flat ... tiered

- Attributes should be considered to be Strings or integers, as appropriate
- All attributes should be considered to be private to the class
- Include a javadoc comment for each attribute

This is the start of the class - is this going along the right lines? We do not know where to go from here. . .

class LectureTheatre {
    public static void main(String[] arguments) {
		
		private int maxOccupancy;
		private int layoutStyle;
		private String lectureTheatreName;
	
			
		}

		
	}
}

without a doubt you received error messages trying to compile this?
remove the 'private' in front of your variables, or declare them outside your method.
since you have to declare them private for the class, and not only for the method, I suggest you to declare them in the class, not in the main method.

it is my belief that you will have gone over the basics OO concepts before been given such a task, so I'd recommend you to put in a bit more effort, improve your code and write more (since you'll need more) and post that here if you run into problems.

This is the start of the class - is this going along the right lines? We do not know where to go from here. . .

class LectureTheatre {
    public static void main(String[] arguments) {
		
		private int maxOccupancy;
		private int layoutStyle;
		private String lectureTheatreName;
	
			
		}

		
	}
}

No. Take main() out altogether at this point. It has nothing at all to do with the class itself.

what is the expected output of that project actually? commonly i would make a 'setter-getter' class or object definition class for the Lecture Theater.

commonly i would make a 'setter-getter' class or object definition class for the Lecture Theater.

you mean create an object? since that's his assignment, I'm pretty sure he 'll eventually do that.

I don't know if your goal is to utilize object-oriented programming or not, but typically I would have 2 separate classes (probably in 2 separate file). One would be the "driver" file that contained main(), and the other would be the object class.

ie:

class LectureTheaterDriver
{
   public static void main(String[] args) 
   {
      LectureTheater lt = new LectureTheater(value1, value2, value3);
   }
}

class LectureTheater
{
   /* Declare global variables HERE */
   private int maxOccupancy;
   private int layoutStyle;
   private String lectureTheatreName;

/* Constructor */
   public LectureTheater(var1 value, var2 value, var3 value)
   {
      /* Whatever you need to do in constructor */
   }
}

Then, from main in LectureTheaterDriver, you would make method calls to any other public methods inside the LectureTheater object you created.

In the end, main winds up being very small with little to no processing and your object does all the work.

That's how I would get started on it anyways.

You might want to look up constructors, getters & setters (which are also referred to as Accessors and Mutators)

Hope that's helpful.

This is the start of the class - is this going along the right lines? We do not know where to go from here. . .

since that line comes...

I don't know if your goal is to utilize object-oriented programming or not

We have been given a task to do the following:-

Write a class LectureTheatre that has the following attributes (properties):

I'm pretty sure that's what they're supposed to do. it would be better for them to first start reading their first chapter instead of skipping class, or just not paying attention, and then sob because they don't understand

I'm pretty sure that's what they're supposed to do. it would be better for them to first start reading their first chapter instead of skipping class, or just not paying attention, and then sob because they don't understand

couldn't agree more, fella. :icon_cheesygrin:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.