ForumsProgramming ForumProgramming Class

89 32996
Darkroot
offline
Darkroot
2,763 posts
Peasant

Would anyone be interested in short programming class that I or anyone competent in programming would teach? It would be a small class with some readings and assignments. I know most of you are busy as so am I so it wouldn't be like University level. But it would be an introduction nerveless maybe a much needed push for some people to start with programming or those who need some structure.

I could teach Actionscript 3, Python or Java (I'm the most proficient with this language). I know some other languages but I doubt anyone wants to learn something as abstract and mathematical as Haskell or as low level as Assembly.

This is just a post to see how many people are interested and in what language.

  • 89 Replies
Darkroot
offline
Darkroot
2,763 posts
Peasant

System.out.println(); both of these messages:

The first output is, "X"
The second output is, /Y/
gunsofliberty
offline
gunsofliberty
27 posts
Nomad

Dark, I'm having some problems,


public class Math {

public static void main(String[] args) {
int x = 1;
int y = 0;
int ax = 6;
int bx = 3;
int c = 2;


y=ax^2+bx+c;

System.out.print( Math.sqrt(x) );
System.out.println ('The first output is, "x&quot
System.out.println ('The second output is, y)
}
}


12 errors. I'm doing this horribly,

Xzeno
offline
Xzeno
2,301 posts
Nomad

Main method in a math class... interesting... the Math class already exists in Java. Don't know if that's a source of errors or not.


y=ax^2+bx+c;
The syntax is entirely wrong here. to square something, you can't use "^2". I think there's a Math method to do it, but it's usually more efficient to multiply it by itself: y = ax * ax + bx + c; should work. No need for parenthesis because the order of operations holds.

System.out.print( Math.sqrt(x) );
System.out.println ('The first output is, "x&quot
System.out.println ('The second output is, y)
Problems abound here. First of all, you need to use double quotation marks: "" for string literals. Single quotes are for character literals. Now, if you want to print the value contained in x, you can't put it in quotes: then it will print the letter x. Rather, you must concatenate the int x to the string literal with the + operator. Try:

System.out.println( "The first output is " + x );

That code would print this: "The first output is 1

For the next line, you'll do something similar.

System.out.println( "The second output is " + y );

If that doesn't solve your issues and you still get an error, it's probably because you can't pass the Math.sqrt method an integer value. Not sure on that one. If that's causing it to throw an exception, cast it to a double.

This advice won't give you the 100% correct output to dark's instructions: you still need to somehow get the double quotes around the x value and the / around the y. I'm sure Dark or I will help you with that if you need it.

Oh hey Darkroot. Mind if I help you with this a little?
maninfrontofthemask
offline
maninfrontofthemask
95 posts
Jester

[quote]System.out.println ('The first output is, "x&quot
System.out.println ('The second output is, y)

Also you are missing semicolon's at the end of the lines

Darkroot
offline
Darkroot
2,763 posts
Peasant

Main method in a math class... interesting... the Math class already exists in Java. Don't know if that's a source of errors or not.


Yeah I've never come across that before I guess don't use the same name of your classes as predefined classes you are actually using.

12 errors. I'm doing this horribly,


Those are mostly from your System.out.println() don't forget semi-colons and complete strings.

y=ax^2+bx+c;


That won't work and you don't need it, try using the actual formula and let it do the math. You don't need to write a general polynomial equation. You only need 3 variables for a,b,c and one or two more for x,y if you want to hold them or you can just place them in the System.out.println which is a bit messy.
Darkroot
offline
Darkroot
2,763 posts
Peasant

Mildly disappointed that only one person has actually finished and another has actual code to show. I'll probably scratch the due dates and make this class open. I'll post exercises here and at some point post the solutions. I'll still respond to emails and posts here normally. I might collect the exercises and format this thing into a programming sticky (hopefully if mods approve of course) for when the new AG will comes out with it's fresh forums.

maninfrontofthemask
offline
maninfrontofthemask
95 posts
Jester

So... do we have another assignment soon?

maninfrontofthemask
offline
maninfrontofthemask
95 posts
Jester

Ummm... Darkroot? (bump)

gunsofliberty
offline
gunsofliberty
27 posts
Nomad

Is this going to be scheduled to another time?

Darkroot
offline
Darkroot
2,763 posts
Peasant

I have finals now so that's the reason for my non-responsiveness. Next assignment should be out Wednesday or Thursday.

For the next assignment do the last assignment if you haven't. Read sections 2.3,2.41,2.44,2.46 and 2.5 will be the last thing we will be covering in chapter 2.

Txsl
offline
Txsl
5 posts
Nomad

I just think I`m pretty strange with the Aciton Script style of coding. I`m learning C++ in University, now I can make codes of template( easy one, of course ) But I really don`t understand AS. And when I try to make a SC2 map with trigger I found something in common. Is that a right way to understand Flash programming?

Darkroot
offline
Darkroot
2,763 posts
Peasant

@Txsl the best way to learn something psychologically, is to apply the knowledge and tie it to whatever you already know.

Next assignment is using text I/O or scanners make a program that takes the users first name, last name, age and initial balance print out a string saying "Hello (first name) + (last name) your current balance is (double + increment by one using incrementation "shortcut&quot.

For assignment 3 do the exercise question in chapter 2, 2.1-2.4, not 2.5 unless you want to but I won't be covering that section yet.
Then do the practice quiz. All the solutions are posted on the site.

Assignment 4 part 1 will consist of upgrading assignment 2 to output &quotlease enter correct input" and not stop execution unless so sort of input is received. This will require both a while loop and and if/else statement with a control Boolean value that will be able to end the while loop if the user inputs correct values.

maninfrontofthemask
offline
maninfrontofthemask
95 posts
Jester

k Assignment 2 questions:

-What do you mean by balance? (like a bank account balance?)
-The program I would think would only output the once so wouldn't the incrementation always be 1 (or an interest rate?), therefore you really don't need a variable for it.
-If the incrementation is a interest rate then the interest rate wouldn't increment, it would compound, which is way different cause when you compound "shortcut" will not change

Maybe I am way off base I just wanted to clear up the assignment

Darkroot
offline
Darkroot
2,763 posts
Peasant

-What do you mean by balance? (like a bank account balance?)
Yes, probably should of made that more clear.

-The program I would think would only output the once so wouldn't the incrementation always be 1 (or an interest rate?), therefore you really don't need a variable for it.


Just the value the user gives you in balance that is incremented by one using the shortcut. That's for you to decide.
Showing 76-89 of 89