My game keeps the top five scores in an array. Before eachround I want a backup, so if the round goes wrong I can putthe old scores back. Make the backup, change two scores theway a round would, and show me both lists so I can see thebackup really is separate.Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.
int[] backup = scores; makes a second name for the same array, and its fix copied three elements by hand. That fix only worked for exactly three.new int[...] makes an empty array of the right size, and a loop fills it.Scores: 999 95 80 60 0Backup: 120 95 80 60 45Verified in a real run. With int[] backup = scores; instead, both lines show 999 95 80 60 0.
Your requirements list and your program file, named cc-copy-machine.