Need help with college homework about making a algotrthm
guys I need help with my homework basicly it wants me to make a algrothm in java to find the average of 4 numbers
74 Replies
ā This post has been reserved for your question.
Hey @demon737sword! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
is it a list
are the numbers in a list
or are they separate variables
it wasnt specific about that
did you have lists or arrays before
or no
no Im current;y restarting from scratch and have no idea what im doing
ok lets just do normal variables then
do you know how to make a variable
uhhh i might idk I just started this class for college
do you know how to run a java program
like the main
class
I think so
currently it doesnt work on the school computers
have you ever seen this
yes
ok so its like very beginner stage java yes
that u have rn
yes
ok then declare 4 int variables
and send the code here
etc
ok so I just put that down 4 teams in between the brackets
that would make it an array
like
yeah
so which option do you want
or what i sent earlier
this one
then make 4 numbers
and paste the code here
\

like that?
now what?
now
we sum it up
š
so do
`
and so on
got it

no
above the bracket
}
do you want the numbers to have decimals like 10.1 or no
well were trying to find the average so yeah
ok
also add the semicolon at the end of the sum line
and paste code
semicolomn added
show code

remove the space
between number4 and semicolon
done
now swap all int to double
and add
and after that
ok
keep in mind the results might return some crazy numbers like
you do
1.1 as for all numbers
it might return something like 1.09999999999999999999
but its normal for like beginner stuff
I dont care I want it to work
gave me this error when I tried runing it

send screenshot of your editor
i mean
the files on the lef
t
shwo me what I should be looking for
you are using visual studio code right
ye
screenshot it all
and send
u can hide stuff u dont wanna sohw
like ur name or something

ok so
you dont have a jdk
so its not gonna run
i would say click the download jdk and install automatically would be ok
however lets ask someone that has more help points than me lolololol
@dan1st | Daniel no jdk and its vs code so i have no clue how to set it up

whicnh ones?
also
first
whats youir file name
the one where you are writing this code
Algorithm
i suggest you put that file in some folder
and you have to name it with .java at the end
otherwise its not gonna run
both work though I would personally either use the second one (if you are ok with the newest version) or install one from Adoptium and then using the third option
(that's adoptium)
Also that's the Oracle extension lol
Do you know the time in my timezone?
of course
but you were typing
5 minutes ago
in general

looks like we wait
for it to load

show full screenshot

how did you run this

what if you right click on the code
is there some option to run it
You could either enable preview features
no
or use a full main class
Kenny Yip Coding
YouTube
How to set up Java in Visual Studio Code
How to install Java with Visual Studio Code (vscode) in under 5 minutes.
Install Visual Studio Code: https://code.visualstudio.com/
Install Java Coding Pack: https://code.visualstudio.com/docs/java/java-tutorial
Open vscode, and create new file. Name it whatever you want, but be sure to include the .java extension.
Ex) Create a file named Te...
also yea
rename the file to
Main.java
and
you need to have

first rename the file to Main.java
and your code should look like this
ok thats it for today im going amimir
gonna check tomorrow

add a main method
and make sure the class name matches the file namw
š¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.Post Closed
This post has been closed by <@840262132649033779>.