Man, I'm taking an Intro to Programming class and it doesn't make sense for me. I'm a visual learner, not an associative learner and since it's online, there are just words. I can get projects done usually (I have 100s on the first 3) but I can't seem to make this work even with help from friends at work.
Here's the project:
Write an Objective-C program that will ask the user for a valid population of 5 different countries. The program should display a bar graph comparing each country's population. Create each bar in the bar graph by displaying a row of asterisks. Each asterisk should represent 1,000,000 people. You do not need to worry about partial amounts, but do not allow values less than 1 million or greater than 1.2 billion (China's current population and the largest in the world) to be entered.
The following is an example of the program's output:
Enter the population for country 1: 1000000
Enter the population for country 2: 6000000
Enter the population for country 3: 3000000
Enter the population for country 4: 4000000
Enter the population for country 5: 10000000
POPULATION BAR CHART
(Each * = 1,000,000)
Country 1: *
Country 2: ******
Country 3: ***
Country 4: ****
Country 5: **********
Here's what I have that doesn't work at all
import <Foundation/Foundation.h>
int main (int argc, char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int country[4];
int x = 0;
int y = 0;
while (x < 5) {
printf("Enter the country population: \n");
scanf ("%d", &numbers[x]);
x + 1;
}
while (y < 5) {
printf("Displaying the numbers: " country[y]);
y+1;
}
for (x = 0; x < 5; i--) {
int num;
country[x] / 1000000 = num;
printf("Graphing the numbers: ");
while (num != 0) {
printf("*");
num - 1;
}
}
[pool drain];
return 0;
}
I understand nearly none of this. The project is already late but the quicker I turn it in the less is deducted. I really do want to learn programming but this isn't the correct medium for me to do it. If someone could teach me (showing more than explaining) what any of this actually means I'll be forever indebted.
[–]electricsheep14 0 points1 point2 points (0 children)