SimpleStudy Schools Book a Demo We can give expert advice on our plans and what will be the best option for your school.
Parents Pricing Home NSC Information Technology Software Engineering Principles A group of mountain passes has been selected to determine specific statistics, such as the number of travellers, fines received by travellers and details about the danger levels of the mountain passes
A group of mountain passes has been selected to determine specific statistics, such as the number of travellers, fines received by travellers and details about the danger levels of the mountain passes - NSC Information Technology - Question 2 - 2016 - Paper 1 Question 2
View full question A group of mountain passes has been selected to determine specific statistics, such as the number of travellers, fines received by travellers and details about the d... show full transcript
View marking scheme Worked Solution & Example Answer:A group of mountain passes has been selected to determine specific statistics, such as the number of travellers, fines received by travellers and details about the danger levels of the mountain passes - NSC Information Technology - Question 2 - 2016 - Paper 1
1.1 An object class called TMountainPass/MountainPass Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Define a class named TMountainPass, including four parameters:
distance (Double)
speedLimit (Integer)
dangerLevel (String)
averageRainfall (Double)
Initialize these attributes in the constructor:
public TMountainPass(double distance, int speedLimit, String dangerLevel, double averageRainfall) {
this.distance = distance;
this.speedLimit = speedLimit;
this.dangerLevel = dangerLevel;
this.averageRainfall = averageRainfall;
}
1.2 A mutator method named setDangerLevel Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Implement the setDangerLevel
method to update the danger level:
public void setDangerLevel(String dangerLevel) {
this.dangerLevel = dangerLevel;
}
1.3 A method named calculateFine Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Create the calculateFine
method:
public double calculateFine(int timeTravelled, double speed) {
double fine = 0;
double avgSpeed = speed / (timeTravelled / 60.0);
if (avgSpeed > speedLimit) {
fine = 500 + (avgSpeed - speedLimit) * 100;
}
return fine;
}
1.4 A method named suggestedDangerLevel Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Define the suggestedDangerLevel
method:
public String suggestedDangerLevel(double avgRainfall) {
if (avgRainfall >= 10) {
return "High";
} else if (avgRainfall >= 5) {
return "Medium";
} else {
return "Low";
}
}
2.1 Button [Question 2.2.1] Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
For this button, determine the selected mountain pass:
String selectedPass = radioButtonsGroup.getSelected();
// assuming the radioButtonsGroup contains the passes
2.2 Button [Question 2.2.2] Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Display information based on user input:
mountainPassObject.getMountainPassInfo();
2.3 Button [Question 2.2.3] Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Calculate fine based on speed and time:
double fine = calculateFine(timeTravelled, speed);
// Display fine formatted as currency
2.4 Button [Question 2.2.4] Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Display rainfall data, check and update danger level:
double rainfall = arrRain[selectedPassIndex][currentDay];
String dangerLevel = suggestedDangerLevel(rainfall);
Join the NSC students using SimpleStudy...97% of StudentsReport Improved Results
98% of StudentsRecommend to friends
100,000+ Students Supported
1 Million+ Questions answered
;© 2025 SimpleStudy. All rights reserved