This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!

Mona Smith

Greenhorn
+ Follow
since Jan 16, 2019
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mona Smith



It gives me the error message above, the code does not run at all
4 weeks ago
Hello everyone, I've needed help on a program that asks the user for 5 countries, their currency name, the exchange rate and displays it in dollars using arrays. This is my code:




Help is much appreciated. Thank you.
4 weeks ago
Oh ok thank you! I tried subtracting one so the line for the student is [row-1][col-1] and that seems to give me the correct answer. Yes, there are unnecessary comments as my teacher wants us to comment on at least every other line of code to help us better understand it. I didn't do it in the second part, as I was still tinkering around with it. No, I have not learnt about methods yet! The only problem now is that I'm not sure how to display a message if the student asks for an array which has not been entered.
1 month ago
Wow thank you so much! It means a lot, I really needed the motivation!
1 month ago
Hello,

I have to write a program for two users, a school admin and a student. The admin must first enter a password and enter 15 courses by day Mon-Fri (1-5) and time Morning, Afternoon, Evening (1-3) into an array. Then the student can enter the day and time and view courses available. If the admin has not entered a course for that day, it should display 'Course not available'. This is the code I have:






But I have two problems: when I try to enter a day and time for the student, this error shows up: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at pkg.Exercise3.main(Exercise3.java:72)
which I know means my array is out of bounds, but I'm not sure why as I entered numbers like 2 for day and 3 for time! Also, I cannot figure out how to display the message that the 'course is not available' if the array has not been filled.

Any help would be much appreciated! Thanks!
1 month ago
Thank you all for the help! And yes, my teacher requires that we comment on at least every other line of code to make sure we understand what we are doing. And thank you, I will put the square brackets immediately following the type from now on.
1 month ago
Here is the correct code:


1 month ago
Thank you so much! It works now!
1 month ago
Hello,

I have an exercise where the goal is to output 15 integers into a 5x3 array, Output the values in chart format and calculate and output the product of each row beside the appropriate row. I am having trouble with getting and outputting the product for each row; as of now my code (below) can output the product for ALL 15 integers entered, but not for each row. Code is below, any help is appreciated!


1 month ago
Hi, I am trying to do a switch case where the user can enter their area and it gives them a list of venues in their area and they can 'book' it at the same time. It is done but the problem I am having is how to get it to ask the user to enter the area again if they enter an integer other than 1-21. Here is the code I have (I've removed some cases from the middle as post was too long but you get the idea):






Thanks
9 months ago