java homework

profilejust-for-me-2014
123mo.docx

This what the instructor sent: If you have taken MIS 210 in the fall of 2013 and have written a custom or individualized class, then write two sub classes based on this individualized class. For example, one student wrote a Watch class (which is now available because that student is not taking MIS 310 this semester, so anyone can choose it, first come first serve though). An example of two subclasses would be analog and digital.

Here is the old assignment need to apply on

Chapter 5 Assignment

package themovie;

import java.text.*;

public class MovieTester {

public static void main(String args[]) {

Movie m1 = new Movie("Avatar","180 minutes","Sam Worthington","Action");

System.out.println("Name : "+m1.getName());

System.out.println("Duration : "+m1.getDuration());

System.out.println("Hero : "+m1.getHero());

System.out.println("Genre : "+m1.getGenre());

double monthSales = m1.averageMonthlySales(42350,250);

NumberFormat currencyFormat = NumberFormat.getCurrencyInstance();

System.out.println("Average Monthly Sales : "+currencyFormat.format(monthSales));

double Profit = m1.profit(1736927000,516262000);

System.out.println("Profit : "+currencyFormat.format(Profit));

System.out.println(m1.tellAboutSelf());

}

}

package themovie;

public class Movie {

private String name;

private String duration;

private String hero;

private String genre;

public Movie(String name1, String duration1, String hero1, String genre1) {

setName(name1);

setDuration(duration1);

setHero(hero1);

setGenre(genre1);

}

public void setName(String aName) {

name = aName;

}

public void setDuration(String aDuration) {

duration = aDuration;

}

public void setHero(String aHero) {

hero = aHero;

}

public void setGenre(String aGenre) {

genre = aGenre;

}

public String getName() {

return name;

}

public String getDuration() {

return duration;

}

public String getHero() {

return hero;

}

public String getGenre() {

return genre;

}

public double averageMonthlySales(double dailyAvgTickets, double price) {

double avgSales = dailyAvgTickets*price*30;

return avgSales;

}

public double profit(double income, double expenses) {

double p = income-expenses;

return p;

}

public String tellAboutSelf() {

String info = "Movie name is "+getName()+",\nDuration is "+getDuration()+",\nHero is "+getHero()+",\nand Genre is "+getGenre();

return info;

}

}

run:

Profit : Rs.1,220,665,000.00

Movie name is Avatar,

Duration is 180 minutes,

Hero is Sam Worthington,

and Genre is Action