# Very New to Java, Topic: Integers

Page 1 of 1

## 4 Replies - 716 Views - Last Post: 28 February 2015 - 10:02 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=371197&amp;s=95e360885c4510d831a1f5d78203bb9b&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 khafia7

Reputation: 0
• Posts: 1
• Joined: 28-February 15

# Very New to Java, Topic: Integers

Posted 28 February 2015 - 12:44 PM

Hi, I'm very new to Java and would appreciate any help I can receive />
How would I even start these programs?

1.) Write a program Smallest that reads three integers from the user and determines the smallest value.

2.) Write a program InOrder that reads in three integers and prints the three integers in sorted order. Use if and if-else statements to compare 3 numbers and sort them.

Output (numbers in red were entered by the user):

```Type three integers: 3 6 2

The integers in sorted order are: 2 3 6
```

3) Write a program MonthsUsingIf that asks the user to enter a month (1 = January, 2 = February, and so on) and then prints the number of days of the month. For February, print "28 days". Use if statements for this program.

4) Write a program MonthsUsingSwitch that asks the user to enter a month (1 = January, 2 = February, and so on) and then prints the number of days of the month. For February, print "28 days". Use switch statement for this program.

Is This A Good Question/Topic? 0

## Replies To: Very New to Java, Topic: Integers

### #2 modi123_1

• Suitor #2

Reputation: 13665
• Posts: 54,541
• Joined: 12-June 08

## Re: Very New to Java, Topic: Integers

Posted 28 February 2015 - 12:47 PM

Break the problems down.

In in the first one.. it asks for you to get three values from a user. What would you do to read key inputs from a console window? What would you do to store those inputs in, say, three integers? Comparing them sounds like a job for a series of 'if' statements.

### #3 blackeagle123

Reputation: 7
• Posts: 66
• Joined: 28-November 13

## Re: Very New to Java, Topic: Integers

Posted 28 February 2015 - 02:45 PM

at least show us what you tried to do !! or you didn't try at all ?

### #4 djjeavons

• D.I.C Regular

Reputation: 114
• Posts: 417
• Joined: 09-January 09

## Re: Very New to Java, Topic: Integers

Posted 28 February 2015 - 04:11 PM

khafia7, on 28 February 2015 - 12:44 PM, said:

Hi, I'm very new to Java and would appreciate any help I can receive />/>
How would I even start these programs?

The suggestion to break down each problem is a very good one, but I wonder, by your statement of how would I event start these programs, if you are missing the very basics? I don't mean to sound patronising but give us an idea of the level you are at at the moment. If you are a complete beginner that doesn't know how to start writing the code, please say so, that's fine, we were all beginners once. Or if it is a case of, I know how to start writing code but don't know how to approach these problems then also please say so.

Reputation: 2
• Posts: 21
• Joined: 20-February 15

## Re: Very New to Java, Topic: Integers

Posted 28 February 2015 - 10:02 PM

I would have to agree with the posts above. I see that really the first two and last two problems are similar to each other. The first two questions both ask for a trio of integers that are then sorted, then the last two ask for a single integer input that then returns a string depending on the input. All of those questions are fairly easy in reality. I would start with the bare minimum basics.... Start by setting up the main method, use a few output lines to prompt for input, then add your collector for input, then with this you can set up a good half of all 4 of these problems. As it states in the forum - We will not do your homework for you! But we are here to help. At the least, take a shot at what you may think it would start with and the group can coach you from there - and its a good group - but if it looks that you are not willing to put forth at least a decent amount of effort, then dont even bother posting. Mind you - Im not saying you didnt try, just that your post makes it seem that way. Take a shot and show us some code!!!!