class Arjun { String[] favoriteMovies = { "Ocean's 11", "Midnight in Paris", "Star Wars", "Casablanca" }; }
Create a new object of type Arjun and store it in a variable named prof. Then, print all String objects in the favoriteMovies attribute of prof (one per line).
Code
class Arjun
{
String[] favoriteMovies = { "Ocean's 11", "Midnight in Paris",
"Star Wars", "Casablanca" };
}
public class Main {
public static void main(String[] args)
{
Arjun obj=new Arjun();
for(int i=0;i<obj.favoriteMovies.length;i++)
System.out.println(obj.favoriteMovies[i]);
}
}
Please save above code in file named Main.java
output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
class Arjun { String[] favoriteMovies = { "Ocean's 11", "Midnight in Paris", "Star Wars", "Casablanca" };...
PLEASE DO BOTH OF THESE IN PYTHON 1) Exercise #1: Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: Two Class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1.0 in the default constructor. A non-argument constructor method to create a default rectangle. Another constructor method to create a rectangle with user-specified height and width. Python...
C# programming
50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (String) edition ( int) published year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method// that return sting representation of Book object. 2-Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title...
Lets get ready for the basketball tournament! Assume the class Bracket has the following interface: class Bracket { public: Bracket(string location); string getdata() const; private: string location; }; The function getdata should return the value of the attribute. Write the member functions for this class. ALSO - rewrite the interface so that the getdata function is virtual. Create a class Team which is derived from the base class Bracket. Include a constructor that accepts the location (Bracket) and the team...
Lab 10C - Creating a new class This assignment assumes that you have read and understood the following documents: http://www.annedawson.net/Python3_Intro_OOP.pdf http://www.annedawson.net/Python3_Prog_OOP.pdf and that you're familiar with the following example programs: http://www.annedawson.net/python3programs.html 13-01.py, 13-02.py, 13-03.py, 13-04.py Instructions: Complete as much as you can in the time allowed. Write a Python class named "Car" that has the following data attributes (please create your own variable names for these attributes using the recommended naming conventions): - year (for the car's year of manufacture)...
Concepts Tested in this Program: Class Design Constructors Objects Inheritance Program: Design a class named Person and its two subclasses, Student and Employee. Make Faculty and Staff subclasses of Employee. A Person object has a name, address, phone number, and email address (all Strings). A Student Object has a class status (freshman, sophomore, junior, or senior). Define the status as a final String variable. An Employee Object has an office number, salary (both ints ), and a date hired. Use...
java
Generics Objectives: OOWorking with a Generic Class 1. Create a class called Node that is Generic. The class has one class attribute that is an element. It will need 2 Constructors, a setter and getter for the class attribute, and a toString method. 2. Write a Lab10Driver that will: Instantiate a Node Integer object with no value. I. Il. Ill. IV. a. Then call the set method to set the value to 5. Instantiate a Node String object with...
in Java and make sure the extra credit is in the program
aswell
Submission Instructions Submit by midnight on the due date and include your submission (a zip file) as an attachment. Assignment Design a class named Animal. An Animal object has the following data members: name (String), age (integer), amount-food-eaten-per-day (integer, representing ounces) and a preferred food (String). Create a toStringO method in the Animal class. Create a no-arg constructor method that sets default values to the 4 data...
in java Create a new project named, firstInitialLastNameCS185EOS. Create and use a class that prints a title. Create a use a menu that contains the following items, and calls corresponding methods that do the tasks the menu describes. Use classes when they're appropriate. Keep the driver class as simple as possible. Give each class, method and property simple, descriptive names using Hungarian notation. Square a number Simply pass a decimal-type number to the object that does this task. Process its...
C++
Question 1) Consider a class Point that models a 2-D point with x and y coordinates. Define the class point that should have the following Private data members x and y (of type int), with default values of 0 A constant ID of type int A private static integer data member named numOfPoints This data member should be o Incremented whenever a new point object is created. o Decremented whenever a point object is destructed. A default constructor An...