I NEED THIS IN SIMPLE JAVA
NOTHING TOO COMPLEX. PLEASE WITH COMMENTS
Try writing a Blueprint/data class of your own that groups together related information of interest to you (e.g. a Movie has a title, director, lead actor/actress, year, etc. or a BaseballHitter has the following attributes: atBats, hits, runs, homeruns... and methods computeBattingAverage and printStats; the batting average would be computed as hits divided by atBats) and a Driver or main class that uses it (i.e. creates objects and calls methods on these objects).
-Thanks for the question. Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks! =========================================================================== import java.util.ArrayList; public class Movie { // instance variables a Movie class should have private String title; private String director; // will store all the leading actor actress names as String private ArrayList<String> leadActorActress; private int year; // default constructor public Movie() { title = "Unknown"; director = "Unknown"; leadActorActress = new ArrayList<>(); year = -1; } // constructor accepts movie title, director and year public Movie(String title, String director, int year) { this.title = title; this.director = director; this.leadActorActress = leadActorActress; this.year = year; } // add actor and actress names public void addActorActress(String name) { leadActorActress.add(name); } //getter public String getTitle() { return title; } //getter public String getDirector() { return director; } //getter public ArrayList<String> getLeadActorActress() { return leadActorActress; } //getter public int getYear() { return year; } // setter public void setTitle(String title) { this.title = title; } // setter public void setDirector(String director) { this.director = director; } // setter public void setYear(int year) { this.year = year; } // return the object as a string public String toString() { String desc = getTitle() + ", directed by: " + getDirector() + ", Released Year " + getYear(); desc += "\nLeading Actor/Actress:\n"; int index = 1; for (String actor : leadActorActress) { desc += index++ + ") " + actor + "\n"; } return desc; } }
===============================================================
public class TestMovie { public static void main(String[] args) { // create an empty object Movie aMovie = new Movie(); // set values to the object using setter methods aMovie.setTitle("GodFather"); aMovie.setDirector("Francis Ford Coppola"); aMovie.setYear(1972); aMovie.addActorActress("Al Pacino"); aMovie.addActorActress("Marlon Brando"); aMovie.addActorActress("James Cann"); aMovie.addActorActress("Richard Castellano"); // print the object invoking the toString() method System.out.println(aMovie); } }
===============================================================
I NEED THIS IN SIMPLE JAVA NOTHING TOO COMPLEX. PLEASE WITH COMMENTS Try writing a Blueprint/data...
no buffered reader. no try catch statements. java code
please.
And using this super class: Medialtemjava a Create the "middle" of the diagram, the DVD and ForeignDVD classes as below: The DVD class will have the following attributes and behaviors: Attributes (in addition to those inherited from Medialtem): • director:String • rating: String • runtime: int (this will represent the number of minutes) Behaviors (methods) • constructors (at least 3): the default, the "overloaded" as we know it, passing in...
need help in Java Now we’ll continue our project by writing a Facebook class that contains an ArrayList of Facebook user objects. The Facebook class should have methods to list all of the users (i.e. print out their usernames), add a user,delete a user, and get the password hint for a user You will also need to create a driver program. The driver should create an instance of the Facebook class and display a menu containing five options: list users...
code in java please:)
Part I Various public transporation can be described as follows: A PublicTransportation class with the following: ticket price (double type) and mumber of stops (int type). A CityBus is a PublicTransportation that in addition has the following: an route number (long type), an begin operation year (int type), a line name (String type), and driver(smame (String type) -A Tram is a CityBus that in addition has the following: maximum speed (int type), which indicates the maximum...
ONLY NEED THE DRIVER CLASS PLEASE!!! Domain & Comparator Classes: 0.) Design a hierarchy of classes, where the Media superclass has the artistName and the mediaName as the common attributes. Create a subclass called CDMedia that has the additional arrayList of String objects containing the songs per album. Create another subclass called DVDMedia that has the additional year the movie came out, and an arrayList of co-stars for the movie. 1.) The superclass Media will implement Comparable, and will define...
I really need help with this, please. This is a java programming
assignment.
Project 1
The first programming project involves writing a program that
computes the salaries for a collection of employees of different
types. This program consists of four classes.
1. The first class is the Employee class, which contains the
employee's name and monthly salary, which is specified in whole
dollars.
It should have three methods:
a. A constructor that allows the name and monthly salary to be...
Please use Java to write the program The purpose of this lab is to practice using inheritance and polymorphism. We need a set of classes for an Insurance company. Insurance companies offer many different types of policies: car, homeowners, flood, earthquake, health, etc. Insurance policies have a lot of data and behavior in common. But they also have differences. You want to build each insurance policy class so that you can reuse as much code as possible. Avoid duplicating code....
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...