import java.io.* /* Class Movie Cost Author: Date: Description: Sponge Bob Sept. 2007 Calculates the cost of a movie based on the input from the user. */ public class Movie Cost ( public static void main(String args[]) throws Exception { Buffered Reader kb = new Buffered Reader(new InputStreamReader(System.in)); // input show time from the keyboard System.out.print ("Please enter the time of show: ('M' for Matinee or 'E' for Evening) char showTime=kb.readLine().charAt(0); // input input ticket type from the keyboard System.out.print("Please enter the type of ticket: ('C' for Child or 'A' for Adult): "); char ticketType = Integer.parseInt(readLine()); // calculate the cost of the ticket double ticketCost = cale Ticket Cost( showTime, ticketType); // output the cost of the ticket System.out.println("The cost of your ticket is " + ticket Cost); } // main method /" method to calculate the cost of a movie ticket given the show time and ticket type */ public static int caleTicketCost (char showTime, String ticketType) 1 double ticket Cost=0; // initialize the cost to 0 if (showTime=='M' && ticketType == 'C') ticketCost = 4.50; if (show Time == 'E' && ticketType == 'C') ticketCost = 5.50; if (showTime='M' && ticketType == 'A') ticketCost = 8.00; if (showTime='E' && ticketType=='A') ticketCost = 10.50; return ticketCost; // cale TicketCost method } // MovieCost class
import java.io.* /* Class Movie Cost Author: Date: Description: Sponge Bob Sept. 2007 Calculates the cost of a movie based on the input from the user. */ public class Movie Cost ( public static void main(String args[]) throws Exception { Buffered Reader kb = new Buffered Reader(new InputStreamReader(System.in)); // input show time from the keyboard System.out.print ("Please enter the time of show: ('M' for Matinee or 'E' for Evening) char showTime=kb.readLine().charAt(0); // input input ticket type from the keyboard System.out.print("Please enter the type of ticket: ('C' for Child or 'A' for Adult): "); char ticketType = Integer.parseInt(readLine()); // calculate the cost of the ticket double ticketCost = cale Ticket Cost( showTime, ticketType); // output the cost of the ticket System.out.println("The cost of your ticket is " + ticket Cost); } // main method /" method to calculate the cost of a movie ticket given the show time and ticket type */ public static int caleTicketCost (char showTime, String ticketType) 1 double ticket Cost=0; // initialize the cost to 0 if (showTime=='M' && ticketType == 'C') ticketCost = 4.50; if (show Time == 'E' && ticketType == 'C') ticketCost = 5.50; if (showTime='M' && ticketType == 'A') ticketCost = 8.00; if (showTime='E' && ticketType=='A') ticketCost = 10.50; return ticketCost; // cale TicketCost method } // MovieCost class
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please help me with this. Programming language being used is java
![a) Find and correct the errors in the program below.
import java.io.*
/* Class Movie Cost
Author:
Date:
Description:
Sponge Bob
Sept. 2007
Calculates the cost of a movie based on the input from the
user. */
public class Movie Cost
{
public static void main (String args[]) throws Exception
{
Buffered Reader kb = new Buffered Reader(new InputStreamReader(System.in));
// input show time from the keyboard
System.out.print ("Please enter the time of show: ('M' for Matinee or 'E' for Evening): ");
char show Time = kb.readLine().charAt(0);
// input input ticket type from the keyboard
System.out.print("Please enter the type of ticket: ('C' for Child or 'A' for Adult): ");
char ticketType = Integer.parseInt(readLine());
// calculate the cost of the ticket
double ticketCost = caleTicketCost( showTime, ticketType);
// output the cost of the ticket
System.out.println("The cost of your ticket is " + ticketCost);
} // main method
/* method to calculate the cost of a movie ticket given the show time and ticket
type */
public static int cale TicketCost (char showTime, String ticketType)
{
double ticketCost = 0; // initialize the cost to 0
if (show Time == 'M' && ticketType == 'C')
ticketCost = 4.50;
if (showTime== 'E' && ticketType == 'C')
ticketCost = 5.50;
if (show Time == 'M' && ticketType == 'A')
ticketCost = 8.00;
if (showTime== 'E' && ticketType=='A')
ticketCost 10.50;
return ticketCost;
} // cale TicketCost method
} // Movie Cost class](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3f2385f1-d7c3-469c-bc1e-b5904e36d8f3%2F0af88411-f1fd-44bb-b4f2-45a97afc4f60%2F8d0f3qs_processed.jpeg&w=3840&q=75)
Transcribed Image Text:a) Find and correct the errors in the program below.
import java.io.*
/* Class Movie Cost
Author:
Date:
Description:
Sponge Bob
Sept. 2007
Calculates the cost of a movie based on the input from the
user. */
public class Movie Cost
{
public static void main (String args[]) throws Exception
{
Buffered Reader kb = new Buffered Reader(new InputStreamReader(System.in));
// input show time from the keyboard
System.out.print ("Please enter the time of show: ('M' for Matinee or 'E' for Evening): ");
char show Time = kb.readLine().charAt(0);
// input input ticket type from the keyboard
System.out.print("Please enter the type of ticket: ('C' for Child or 'A' for Adult): ");
char ticketType = Integer.parseInt(readLine());
// calculate the cost of the ticket
double ticketCost = caleTicketCost( showTime, ticketType);
// output the cost of the ticket
System.out.println("The cost of your ticket is " + ticketCost);
} // main method
/* method to calculate the cost of a movie ticket given the show time and ticket
type */
public static int cale TicketCost (char showTime, String ticketType)
{
double ticketCost = 0; // initialize the cost to 0
if (show Time == 'M' && ticketType == 'C')
ticketCost = 4.50;
if (showTime== 'E' && ticketType == 'C')
ticketCost = 5.50;
if (show Time == 'M' && ticketType == 'A')
ticketCost = 8.00;
if (showTime== 'E' && ticketType=='A')
ticketCost 10.50;
return ticketCost;
} // cale TicketCost method
} // Movie Cost class
![public static void main (String args[]) throws IOException
int highest, lowest;
int product = 1;
Buffered Reader kb = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter the lowest integer: ");
lowest = Integer.parseInt(kb.readLine());
System.out.println("Enter the highest integer: ");
highest = Integer.parseInt( kb.readLine());
for (int count = highest ; count >= lowest ; count--)
1
product product* count;
1
System.out.println("The product is: " + product);
} // main method
Describe the purpose of the above program. Can it be used for a common math
operation? What is it?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3f2385f1-d7c3-469c-bc1e-b5904e36d8f3%2F0af88411-f1fd-44bb-b4f2-45a97afc4f60%2Fi58nzv4_processed.jpeg&w=3840&q=75)
Transcribed Image Text:public static void main (String args[]) throws IOException
int highest, lowest;
int product = 1;
Buffered Reader kb = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter the lowest integer: ");
lowest = Integer.parseInt(kb.readLine());
System.out.println("Enter the highest integer: ");
highest = Integer.parseInt( kb.readLine());
for (int count = highest ; count >= lowest ; count--)
1
product product* count;
1
System.out.println("The product is: " + product);
} // main method
Describe the purpose of the above program. Can it be used for a common math
operation? What is it?
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY