Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with assignment  RSS feed

 
Elijah Antoine
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had an assignment that was due a few hours ago. I did not know how to do the assignment, but since we have a test next week, I figured that I needed to still get the assignment done anyway so that I could study it. Not sure if I can post links here or not because I'm new.

https://www.cct.lsu.edu/~sbrandt/csc1351/03/1351-arrays.php

Any type of help is welcome. Thank you in advanced.
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First, welcome to the ranch.

Anyway, what have you done so far? What trouble you are running into? It would also help if you provide as much detail as possible regarding your confusion. In fact, sometimes, while gathering your details, to the point of working out the questions to ask, you can sometimes hit an "aha" moment, and figure out what to do next.

Henry
 
Elijah Antoine
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently stuck on the third constructor. It says that it has to specify a range. I know that the "Arrays" package has an easy way of doing this, but the instructions do not allow the use of the "Arrays" package.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you got so far?
How did you do your answer for Contructor #1? Constructor #2?

You should just have to build on those for Constructor #3.

You will have to
- create a new array object - what size should it be?
- check the ranges you have been given are valid for the input array
- copy from the "input" array to your "new" array. Presumably with the assignment statement. i.e. targetArray[index] = sourceArray[fromIndex]. That will probably require a loop.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!