Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:20:01+00:00 2026-06-05T20:20:01+00:00

In the program I’m creating, the user will input values to create an array

  • 0

In the program I’m creating, the user will input values to create an array of videos. Each video contains several data fields (number, title, publisher, duration & date). However what I am currently trying to acheive is to let the user choose a particular video in the array they just created, select the data field they wish to rename, rename the value and then set the renamed value as the new value. Here is my code for adding videos to an array:

public Library createLibrary()
{
    Library video = new Library();
    java.util.Scanner scannerObject =new java.util.Scanner(System.in); 
    for (int i = 0; i < videos.length; i++)
    {
    //User enters values into set methods within the Library class
    System.out.print("Enter video number: " + (i+1) + "\n");
    String number = scannerObject.nextLine();
    System.out.print("Enter video title: " + (i+1) + "\n");
    String title = scannerObject.nextLine();
    System.out.print("Enter video publisher: " + (i+1) + "\n");
    String publisher = scannerObject.nextLine();
    System.out.print("Enter video duration: " + (i+1) + "\n");
    String duration = scannerObject.nextLine();
    System.out.print("Enter video date: " + (i+1) + "\n");
    String date= scannerObject.nextLine();
    System.out.print("VIDEO " + (i+1) + " ENTRY ADDED " + "\n \n");
    //Initialize arrays
    videos[i] = new Library ();
    videos[i].setVideo( number, title, publisher, duration, date  );
    }
    return video;
}

And here is the basic concept for my select and replace function for those who can’t figure out what I mean:

public void replaceVideo(Library[] videos, String replaceTo, String replaceWith) 
    {
    for (int i = 0; i < videos.length; i++) 
        if (videos[i].equals(replaceTo)) {
            videos[i]= replaceWith;
        }
    }

Simpler solutions will be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:20:02+00:00Added an answer on June 5, 2026 at 8:20 pm

    Try comparing replaceTo to the name of the video (or whatever replaceTo is supposed to match):

    if (videos[i].getName().equals(replaceTo)) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My program asks a user to create a 4-digit passcode (much like the unlock
Program runs once and it both throws data to the pipe and gets it
The program I'm coding now makes a pretty huge list of data items. Now,
My program collects the number of bottles collected by four rooms. When the user
program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; var ints: array[1..2] of Integer =
/*Program to merge to arrays using pointers in descending order, when the first array
Program A, is a c program that endlessly, receives input in stdin, process it
program reads the following data from a .txt file: f 3.40 f 4.00 m
A program receives a list of Messages (base type). Each message in the list
Program Details: I am writing a program for python that will need to look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.