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...
icon
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
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?
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
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY