troubleshooting Question

Java Access control modifiers and Constructors

Avatar of jachill98
jachill98 asked on
Java
2 Comments1 Solution346 ViewsLast Modified:
Good afternoon,

I am try to write the code for a program that calls for the following information:

A class, Cinema has the following features:

Fields:

public static String theatre;
private String title;
private String kind; // Drama, comedy, family, ..
private String actor;
private String actress;
private int ticketPrice;

Constructors::

Cinema()

No-arg constructor. Does not initialize to anything.

Cinema(String titl, String knd, String actr, String actrs, int tp)

Initializes fields respectively.

Methods:

public void display()

Displays all field values- title, kind, actor and actress.

public int totalTicketPrice(int num)

Computes the total ticket price for num, tickets
Write a main class and create an object of the Movie class. Use the methods to print
results. Give your own values. Also, print the value of the static field

Here is the code that I have already written so far:
class Cinema
{
public static void main(String[] args)
{
Cinema cinema1=new cinema();
cinema1.title="Star Wars";
cinema1.kind="Drama";
cinema1.actor="Mark Hamill";
cinema1.actress="Carrie Fisher";
cinema1.ticketPrice=8;
cinema1.display();
System.out.println("Total cost is:" +cinema1.ticketPrice*(3));
}
}
class cinema1
{      
private String title;
private String kind;
private String actor;
private String actress;
private int ticketPrice;
cinema1(String titl, String knd, String actr, String actrs, int tp)
{
title = titl;
kind = knd;
actor = actr;
actress = actrs;
ticketPrice = tp;
}
}
I keep getting the errors saying cannot find the symbols I have created. Can someone point me in the right direction? Thank you.
ASKER CERTIFIED SOLUTION
Mick Barry
Java Developer
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros