COMP3200 Anonymous Questions and Answers |
This page lists the various questions and answers. To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.
We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course.
Submission reference: IN2734
Open the tech-support1 project. Find the following code in the getInput method of the InputReader class:Can I have some help with this because I don't really understand what I'm supposed to do please.String inputLine = reader.nextLine(); return inputLine;Edit the method so that the String that is returned does not have spaces at either end of it. (Use the API documentation for the String class to work out how to do that.)
Open the API documentation for the String class and search for the word space
on the page. You will quickly find several methods that can be called on a String to remove spaces from various places. Use one of the method you find that way to complete the exercise.
Submission reference: IN2730
What does arg mean? This is related to making a main method.
In the following, args
is the name of the parameter received from outside the program. Argument and parameter mean the same thing, so it is short for 'arguments':
public static void main(String[] args)
Keywords: main-method
Submission reference: IN2729
when it says "Consider placing the main method in a separate class. " does this means in an diffrent java file because should only have one class per file?
Yes, that is right. A separate file.
Keywords: main-method
Submission reference: IN2720
In one of our lectures this week ( i forgot which one) you said that for the in class assignment there will be practice examples or something to help us prepare for that in advance. However after looking at moodle I have not seen anything yet, is this going to be set soon or is it meant to be set a few days before the actual assesement?
I will make it available early this week (week 18/10) so that you have a reasonable amount of time to practice before the real thing in week 19/11.
Keywords: assign5
Submission reference: IN2719
Hi, Have you got any advice for second years?
Also, I now have only 2 spoons for hot chocolate.
I do confess to be slightly baffled by these questions, but I will do my best to answer them.
My advice to second years is to ensure that you progress to the final year.
2 spoons are perfectly sufficient to become a competent programmer, so no worries there.
Keywords: hot-chocolate , spoons
Submission reference: IN2718
for Question 155 (2022), would this be correct.
code deleted
Yes, that is correct.
Keywords: ex-7-20
Submission reference: IN2716
im struggling for the returning one item from the list exerise, this is what i have.
code deleted
You have the right pieces but have not yet connected them in the right way. When calling the get method on a list, you need to provide a parameter. That parameter must be the index you want to select. So, think of it this way:
return list.get(random-integer-value);
Keywords: ex-7-20
Referrers: Question 156 (2022)
Submission reference: IN2713
for exercise 7.10, Edit the method so that the String that is returned does not have spaces at either end of it, would we use the deleted method or the deleted method. Im unsure on the differences
Yes, either of those is fine. One has a slightly different effect than the other but, for the purposes of this exercises, both are fine to use.
Keywords: ex-7-10
Submission reference: IN2712
how do i join the homework club
You just turn up to room SW18 in the basement of Computing on one of the session times, which are:
Keywords: homework-club
Submission reference: IN2711
for Question 150 (2022), would this be correct.
code deletedlower will be a String variable.
No because Strings are immutable, so calling toLowerCase on a String does not change the String it is called on. That is the case with all methods, such as trim, substring, etc.
Submission reference: IN2710
I was thinking about how useful the vevox question asking is and was wondering do other programming modules use it?
We are glad that you find it useful. I am not aware of any others that use it in the way that we do. At the end of the module there will be a chance to provide further feedback on all your modules and it would be worth highlighting the value of it in this module's feedback, because we do report back to the Board of Studies and others might pick up on that.
Keywords: vevox , module-feedback
Submission reference: IN2709
im struggling to understand what this means.
Write down a call to the toLowerCase method on a String variable called text and store the result of the call in a variable called lower. What must the type of the variable lower be?
It means, suppose you have a variable of type String called text and you call its toLowerCase method. What is the type of the result.
Referrers: Question 152 (2022)
Submission reference: IN2708
i am stuck on the 2 last question of class 7 week 17 excersises how to we iterate throught a HashMap collection? i have tried for each which is not possible and while trying to use a while loop i found hashmap does not have an iterator method.
The simplest way is either to iterate over its keys or its values. There are methods for both in the API documentation for HashMap.
Keywords: class-HashMap
Submission reference: IN2707
when will the mock be available, also will we need hash for the assessment
I will make it available shortly. HashMaps could be included in the assessment, along with any other material covered on the course up to the point of the assessment.
Submission reference: IN2706
Can you start to post solutions to the weekly class exercises
I won't be posting solutions to the class exercises.
Submission reference: IN2705
when using java api i am Not sure how to tell difference between if method will change the string its called on or results in creation of new one with slightly different contents.
the trim method change string its called on while the toLowerCase method results in creation of new string with slightly diffrent contents but i cannot tell the diffrence from the api documentaion.
In fact, none of the String methods actually change the contents of the string they are called on because strings are immutable. All of the methods like trim and toLowerCase return a new version of the original string.
Keywords: API
Submission reference: IN2704
Do we need to attend the class in week 20/12 if we get all our work marked off in 18/10?
There will be further exercises to complete in the week 20 class.
Keywords: class-exercises , week-20
Submission reference: IN2703
Hello, my test assistance centre is not testing or compiling. It keeps on saying there is a problem with this method, the centre.list line :
/** * Test the list method. * Note that this method does not check the * format of the output. */ public void list() { centre = new AssistantCentre(); makeAssistant(1, 2, false); makeAssistant(5, 1, true); centre.list(); }Could you help with this?
I suspect you have made an inappropriate change to the header of the list method in AssistantCentre.
Keywords: assign2 , method-list
Submission reference: IN2702
why is the first if statement not working? and why is the rest of it not working?
code deleted
You have a return statement in the body of the loop, so not every assistant is examined for being the closest.
Keywords: assign2 , method-findNearestAvailable
Submission reference: IN2701
for Question 93 (2022), would this be of better quality?
code deleted
Yes, that is very good. Just note that instead of:
if(available == true)
you can simply write
if(available)
Keywords: assign2 , method-setAvailability
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. |