Fred Masen

Ranch Hand
+ Follow
since Feb 23, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
7
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Fred Masen

Yes Campbell the comments are for real Keep in mind that for the past few years we went from C & C++, Java to Python in CS as beginner language because most students could not comprehend C/C++/Java. Still with the ease of python most CS students give up. So they are trying to introduce python in high school with their math course hoping that after  graduation they will be familiarized with python programming and encourage them to enroll into CS and not giving up. But honestly  I don't think the problem is programming languages......

@ Salvin thanks for the answer. It did run but honestly I prefer VSC.
7 months ago
Salvin how do you open notepad++ using linuxMint ? I got it installed using snap. But after that I don't see it anywhere. When I make sure it is installed it gives me : snap "notepad-plus-plus" is already installed, see 'snap help refresh'
7 months ago
Salvin I know that a single change of the code can alter the entire program. As I said I gave up so many times this hobby programming that I know what you mean I started with C for dummies in the 1997, I think and Java was starting to get out to the public and the only Editor for Java was Netbeans from Sun Microsystem if I remember well it was so heavy and eating memory so much that it was totally useless  for the  Windows 95 users. But fortunately Windows had an internal blue editor that allowed us to edit java code but you had to run the program from the command line of course. Windows users at that time tried to install the early versions of Linux but they were far from beinge stable , you had so many packages to install with missing dependencies that it was a big nightmare for everybody. However after getting help from the " Yahoo programming rooms" At that time that was the only place you could get help(C_Dreamer was the leader the big guy in C who wrote programs for Boeing ( Richard Heathfield) he also got a book out called "C Unleashed ", the community was fun and everybody was helping each others), I had my Mandrake Linux version working properly with the help of the Linux rooms:)
7 months ago
Salvin I use the proper way but Eclipse gave me so many errors while I was typing the code that I had to change it constantly. However you are correct about the bug but if you could demonstrate me how you can get this piece of code working properly without getting into classes and obtaining  the correct average age, I would deeply appreciate. Understand also that after a few hours of frustration I did not know what I was typing at the end
7 months ago
Also one thing that I need to mentioned which is "out of the topic" but could help b4eginners is using Eclipse and Visual Studio Code helped me a lot. It seems that the visibility on Eclipse is not as great as VSC but Eclipse shows more precise debugging capabilities and suggestion than with VSC. Secondly I noticed that 2 years ago I was using way too big fonts with Eclipse which after a few hours of programming I was frustrated when I was not getting my code to work. So both of those IDE help me a lot but as I age I seems to get less patient and frustrated faster. Also when I cannot get a program to work after a few hours I tend to want to give up. So I stop but then my brain keep thinking about it , I guess the ego is challenged and usually I don't sleep well because the brain keeps working unconsciously all night trying to figure out a solution to the problem. However one thing that I noticed is when I program my chess level seems to raise up and the opposite is true too when I play chess more often I tend to understand programming better.
7 months ago
Yes Campbell That's exactly the books you mentioned in your link. The example that I posted is the same it is in the book. The Gaddis book is usually easier to follow for a beginner in Java because the examples that he usually shows to explain his concepts are easy to follow, mostly accounting and real life examples compared to other books that use way too many abstract examples. However the book does not expose the methods before chapter 5 and you have to way to chapter 6 before even talking about creating classes. And the concept of array is mentioned after the study of classes which does not make sense to me. But beside that most people like the book because it's really beginning friendly. I was thinking following the Dietel Java book because as you said it shows very quickly how to create objects , methods and classes but it tend to be more aimed toward  programmers who have already some experience in other languages. The only Dietel books that explains really well a programming language is How to program in C. With this one Deteil did a fantastic job but it was also one of their first book they published so they took the time to familiarize the new programmer with very well explained examples.  
7 months ago
You are correct Piet. I think that's the only way to do it. The only reason I was trying to do using the for loop is that the book I am following now show the array and building different classes in the following(further) chapters which mean I did not study the array and making new classes yet. But I see what you mean because as I said I gave up so many times Java in the past few years that I did learn array and classes in the past. The last time I gave up was 2 years ago so I have to get back to the basics again carefully before comprehending well the following chapters. But you are right your suggestion seems to be the best way to do it. Thanks.
7 months ago
The book is : Starting Out with Java: From Control Structures through Objects (6th Edition) .  It is follow by many computer sciences schools.
The example I have is from that book :
- However to improve my programming skills I try to always add a new feature in the program example which is the "age feature(average)
However in this program it seems that when I implement that age feature it's giving wrong results for the entire program (score age etc..)
- I try to add a second total1 and second ageAverage  to avoid  messing up with the score feature. Also I don't need an age average in each student
all I need is an age average after the end of the program which makes since. I tried to figure out that I could get a method outside
the for student loop but it will not work . Anyway here's the example of the book :

The program in Code Listing 4-13 shows another example. It is a program that a teacher
might use to get the average of each student’s test scores. In line 22 the user enters the num-
ber of students, and in line 26 the user enters the number of test scores per student. The for
loop that begins in line 29 iterates once for each student. The nested inner for loop, in lines
36 through 41, iterates once for each test score.


How many students do you have? 3 [Enter]
How many test scores per student? 3 [Enter]

Student number 1
-----------------------
Enter score 1: 100 [Enter]
Enter score 2: 95 [Enter]
Enter score 3: 90 [Enter]
The average for student number 1 is 95.0.
Student number 2
----------------------
Enter score 1: 80 [Enter]
Enter score 2: 81 [Enter]
Enter score 3: 82 [Enter]
The average for student number 2 is 81.0.
Student number 3
----------------------
Enter score 1: 75 [Enter]
Enter score 2: 85 [Enter]
Enter score 3: 80 [Enter]
The average for student number 3 is 80.0.
7 months ago
See :

Program Output with Example Input Shown in Bold
How many students do you have? 3 [Enter]
How many test scores per student? 3 [Enter]
223224
Chapter 4   Loops and Files
Student number 1
-----------------------
Enter score 1: 100 [Enter]
Enter score 2: 95 [Enter]
Enter score 3: 90 [Enter]
The average for student number 1 is 95.0.
Student number 2
----------------------
Enter score 1: 80 [Enter]
Enter score 2: 81 [Enter]
Enter score 3: 82 [Enter]
The average for student number 2 is 81.0.
Student number 3
----------------------
Enter score 1: 75 [Enter]
Enter score 2: 85 [Enter]
Enter score 3: 80 [Enter]
The average for student number 3 is 80.0.
7 months ago
I understand Francis but as I said I changed the code so much that it is not behaving logically as results. Look at the above example from Gaddis and the results are perfectly fine. The issue for me is to add an age & average age feature to that program without messing up the program.
7 months ago
Basically it is like ok I understand that very well let me try to add an average age feature into that program. And then I can't do it !
7 months ago
Francis I manipulated the code so much to get the age feature added to my program that all results were wrong. Look above my previous post I added the Gaddis example(original) and I understand it very WELL and it worked perfectly fine. But soon as I tried to add the feature age , it is missing up with the "total" then it is probably missing a for loop age to work. I just don't know how to do it with that age and average age feature.
7 months ago
Here's the Gaddis example from the book :
And I want is to add an age feature that allows me to get the average age of the students. Bu I can't figure it out.



Program Output with Example Input Shown in Bold
How many students do you have? 3 [Enter]
How many test scores per student? 3 [Enter]
223224
Chapter 4   Loops and Files
Student number 1
-----------------------
Enter score 1: 100 [Enter]
Enter score 2: 95 [Enter]
Enter score 3: 90 [Enter]
The average for student number 1 is 95.0.
Student number 2
----------------------
Enter score 1: 80 [Enter]
Enter score 2: 81 [Enter]
Enter score 3: 82 [Enter]
The average for student number 2 is 81.0.
Student number 3
----------------------
Enter score 1: 75 [Enter]
Enter score 2: 85 [Enter]
Enter score 3: 80 [Enter]
The average for student number 3 is 80.0.
7 months ago
Francis here is what I get :
How many students do you have? 2
How many test scores per student? 2
Enter the age of student 1
15
Student number 1
--------------------
Enter score 1: 10
Enter score 2: 20
The average for student 1 is 22.0.

And the average age is : 45.0
Enter the age of student 2
10
Student number 2
--------------------
Enter score 1: 30
Enter score 2: 40
The average for student 2 is 62.0.

And the average age is : 62.0
7 months ago
Campbell here's what I get when I changed to double :
What I would like from the program is to ask me the age of the student and at the very end giving me average of all the ages .

How many students do you have? 2
How many test scores per student? 2
Enter the age of student 1
26
Student number 1
--------------------
Enter score 1: 140
Enter score 2: 140
The average for student 1 is 153.0.

And the average age is : 306.0
Enter the age of student 2
28
Student number 2
--------------------
Enter score 1: 250
Enter score 2: 250
The average for student 2 is 417.0.

And the average age is : 417.0
7 months ago