Question

Using Java, write a program that contains an array. The array will contain the titles of...

Using Java, write a program that contains an array. The array will contain the titles of your favorite books, games, shows, or movies. You may make it as large as you desire, but only enter the titles through user input.

Sample output: “Dragon Wing”, “Doom Patrol”, “Pokemon”, “Star Wars”

NOTE: Include step-by-step instructions in hidden notes.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;

public class PrintMovies {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] movies = new String[5];
        for (int i = 0; i < movies.length; i++) {
            System.out.println("Enter a movie name: ");
            movies[i] = in.nextLine();
        }
        System.out.println("Your favorite movies are: ");
        for (int i = 0; i < movies.length; i++) {
            System.out.print(movies[i]);
            if (i != movies.length-1) {
                System.out.print(", ");
            }
        }
        System.out.println();
    }
}
Add a comment
Know the answer?
Add Answer to:
Using Java, write a program that contains an array. The array will contain the titles of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Write a program that contains an array. The array will contain the titles of your...

    1. Write a program that contains an array. The array will contain the titles of your favorite books, games, shows, or movies. You may make it as large as you desire, but only enter the titles through user input. Sample output: “Dragon Wing”, “Doom Patrol”, “Pokemon”, “Star Wars” 2. Write a program that creates a class to represent what you spend your time on every week. Inside of that class, you will need a 2D array that represents each day...

  • In JAVA write a program that contains an array containing 10 integers (1 to 10). user...

    In JAVA write a program that contains an array containing 10 integers (1 to 10). user insert an integer from (1 to 10) , method is library sort or gapped insertion sort that will each sort the array and print it out to the console.

  • in java please Write a program that contains an array with all of your friends' first...

    in java please Write a program that contains an array with all of your friends' first names. Enter the values in any manner and order you choose (I recommend favorites first). Now take that array and sort it alphabetically so that names that start with ‘A' c me first. Look to see if you have any duplicates and if you find any, print out their names. You may use a binary search to determine this. 2. Sample output: Input list...

  • In c++ Write a program that contains a class called Player. This class should contain two...

    In c++ Write a program that contains a class called Player. This class should contain two member variables: name, score. Here are the specifications: You should write get/set methods for all member variables. You should write a default constructor initializes the member variables to appropriate default values. Create an instance of Player in main. You should set the values on the instance and then print them out on the console. In Main Declare a variable that can hold a dynamcially...

  • write a java program that does the following Part one Use a For loop to compute...

    write a java program that does the following Part one Use a For loop to compute the sum of all the odd numbers from 1 through 99. Your result should be labeled, and the value should be 2500. Print your name 7 times using a While loop. String dogNames[ ] = {"Sam","Buster","Fido","Patches","Gromit","Flicka"}; Using the array defined here, print the values of the array vertically and horizontally using one For-Each loop. Reverse the logic (Nested loops: Indent text) so that the...

  • ****WRITE A JAVA PROGRAM THAT : Write a method named stretch that accepts an array of...

    ****WRITE A JAVA PROGRAM THAT : Write a method named stretch that accepts an array of integers (that the user inputs) as a parameter and returns a new array twice as large as the original, replacing every integer from the original array with a pair of integers, each half the original. If a number in the original array is odd, then the first number in the new pair should be one higher than the second so that the sum equals...

  • Write a Java program that contains a method named ReadAndFindMax. The argument to this method is...

    Write a Java program that contains a method named ReadAndFindMax. The argument to this method is the filename (of String type). The method opens the file specified in the method argument filename and then reads integers from it. This file can contain any number of integers. Next, the method finds the maximum of these integers and returns it. The main method must first ask the user to enter the filename; then call ReadAndFindMax method with the entered filename as an...

  • Write a program that reads a string from the keyboard and tests whether it contains a...

    Write a program that reads a string from the keyboard and tests whether it contains a valid time. Display the time as described below if it is valid, otherwise display a message as described below. The input date should have the format hh:mm:ss (where hh = hour, mm = minutes and ss = seconds in a 24 hour clock, for example 23:47:55). Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from...

  • Hello. I am using a Java program, which is console-baed. Here is my question. Thank you....

    Hello. I am using a Java program, which is console-baed. Here is my question. Thank you. 1-1 Write a Java program, using appropriate methods and parameter passing, that obtains from the user the following items: a person’s age, the person’s gender (male or female), the person’s email address, and the person’s annual salary. The program should continue obtaining these details for as many people as the user wishes. As the data is obtained from the user validate the age to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT