Recent content by smilesofmiles
-
S
Java Java Help with displaying an array list while using other classes
Thank you for the advice and the link! :-)- smilesofmiles
- Post #3
- Forum: Programming and Computer Science
-
S
Java Java Help with displaying an array list while using other classes
This is a class assignment that has been puzzling me for a few hours. I need this to print out the values from the passenger array. My code so far prints the values from my aircraft class perfectly but not from my passenger class. Please see my output below: How do I make the output display...- smilesofmiles
- Thread
- Array Classes Java List
- Replies: 2
- Forum: Programming and Computer Science
-
S
Java Trouble with Buffered Reader and Exceptions in Java?
Hello I like Serena! When I run my program it fails. I keep encountering this message. The last program I made with exceptions didn't have any error messages. Thank you for answering me! :-)- smilesofmiles
- Post #3
- Forum: Programming and Computer Science
-
S
Java Trouble with Buffered Reader and Exceptions in Java?
Hello mathhelpboards community! I can't figure out how to get my code to execute while using buffered reader and try with resources. :-( I created a data.txt file correctly and it contains the numbers "0.5 3 10 70 90 80 20" without quotes. I added a catch IO Exception utilizing the...- smilesofmiles
- Thread
- Java
- Replies: 3
- Forum: Programming and Computer Science
-
S
Java Java- Printing an Original Array while Performing Operations on an Array Copy
Thank you both! That last bit did the trick. :-) I think knowing how to do this will definitely help me with future projects. :D- smilesofmiles
- Post #5
- Forum: Programming and Computer Science
-
S
Java Java- Printing an Original Array while Performing Operations on an Array Copy
Okay, I added elements to the second array. Is there something I'm missing? The program still won't display the original numbers. Thank you for the response!package calcavgdropsmallest;import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Scanner; import...- smilesofmiles
- Post #3
- Forum: Programming and Computer Science
-
S
Java Java- Printing an Original Array while Performing Operations on an Array Copy
Hello mathhelpboards community! Please help! Thank you. :-) I need my code to print out the user's original array that is to say the numbers in the way the user entered them. I tried making a copy of the original array and then did all of the arithmetic on it. I sorted the array copy in...- smilesofmiles
- Thread
- Array Java Operations Printing
- Replies: 4
- Forum: Programming and Computer Science
-
S
MHB Solving a Program to Take & Average Unknown Number of User Inputs
Never mind, I figured it out. It doesn't stop between 5 and 10 inputs but as long as the user follows the prompt it should be okay. public static double [] getArrayNumbers(){ Scanner input = new Scanner(System.in); String numbers = input.nextLine(); String[] strHolder =...- smilesofmiles
- Post #2
- Forum: Programming and Computer Science
-
S
MHB Solving a Program to Take & Average Unknown Number of User Inputs
I want to alter my program so it can take an unknown amount of elements (user inputs). I want the program to automatically count the numbers the user is inputting up until they hit enter to the next line. I think I got the program to keep track of this but now my output is a bunch of zeros in...- smilesofmiles
- Thread
- Average Program
- Replies: 1
- Forum: Programming and Computer Science
-
S
Java Java Help with Methods: Solve Your Method Struggles
Wow! Thank you for the detailed response. Your explanation helped immensely. Here is what I ended up with. package patternmakerwithmethods; import java.util.Scanner; public class PatternMakerWithMethods { public static int getNumberColumns(){ Scanner in = new...- smilesofmiles
- Post #3
- Forum: Programming and Computer Science
-
S
Java Java Help with Methods: Solve Your Method Struggles
I am having a difficult time with methods in java. I've been able to get my program to run correctly without methods. My for loop does as intended by printing an alternating rectangular pattern with no separator at the ends. However, after trying to decompose my code into 3 methods I've hit a...- smilesofmiles
- Thread
- Java
- Replies: 2
- Forum: Programming and Computer Science
-
S
MHB Understanding nested for loops when decrementing
I don't know why I thought the inner loop absolutely had to keep decreasing past 0. Also, I wasn't quite sure on placements for the braces but now I think I've got it. My teacher tends to not use them in her codes. Thank you for taking the time to help me learn. :-)- smilesofmiles
- Post #5
- Forum: Programming and Computer Science
-
S
MHB Understanding nested for loops when decrementing
I'm sorry about that I should've been much clearer! There is no specific problem just a lack of understanding about decrementing nested for loops. The first code I had posted above used this particular line that I am having trouble wrapping my head around. #include <iostream> using namespace...- smilesofmiles
- Post #3
- Forum: Programming and Computer Science
-
S
MHB Understanding nested for loops when decrementing
Hello! :-) I am having a hard time with understanding the logic behind decrementing nested for loops. The review problem I'm dealing with is below. This one makes the numbers go backwards. #include <iostream> using namespace std; int main(){ for (int i = 0; i < 5; i++){ for (int j = i; j >=...- smilesofmiles
- Thread
- For loops Loops
- Replies: 5
- Forum: Programming and Computer Science
-
S
MHB Finding duplicates in a user defined array using a function
My code almost does what I want it to do. It displays the position of the duplicate but does the last duplicate position instead of the first. However, I didn't know there was a function called find_first_of! I was trying to use break to exit out of the loop after finding the first duplicate and...- smilesofmiles
- Post #5
- Forum: Programming and Computer Science