12,635,232 members (25,306 online)
Rate this:
See more:
5)
Program 1

Assume you have N eggs and you pack them 12 to a carton. Write a program that determines how many egg cartons
you need and how many eggs will be left over.

The output should be formatted as follows:

Total number of eggs is ___
Number of cartons needed is ___
Number of eggs left over is ___

Run your program for N = 11 and N = 37.

Program 2

An insurance company will adjust the amount of automobile insurance policies according to the following rules:

If a customer is under the age of 25 and has had no claims in the past year, there is no increase to their policy
price. If they are under the age of 25 and they have had any claims in the past year, their policy
price is increased by \$100. If they are 25 or older and have had no claims in the past year, there is no
increase to their policy price. If they are 25 or older and have had any claims, their policy price is
increased by \$50.

Write a program that will determine the amount of policy price increases.
Use a variable 'age' for the age and a variable numClaims for the number of claims.
Your output should be formatted as follows:

Age = ___ Claims = ___ Policy Increase = ___

Make sure you run enough combinations of data to ensure that your program works correctly.

Please submit .java source code files and screen captures.
Posted 31-Aug-12 4:27am
Updated 31-Aug-12 8:03am
v4

"Please submit .java source code files and screen captures." ... no thanks. I did my homework when I was in school. I do not feel a need to do yours for you.
__TR__ 31-Aug-12 9:32am

What have you tried ?
Joan Murt 31-Aug-12 9:55am

Put your flame suit on. You are going to be ELEPHANTED...

1. Elephanted: word with F that Codeproject members use to say Fu**.
2. This is not how we work here:
You can get plenty of help and a wonderful group of experts and resources here in CP, but what you won't get is help to do your homework. We will help you with specifc problems, when you will be stuck at some place, but we won't make the entire job for you. It is not a good idea, you are learning now, if we make that for you what will you do at the exams or at the job you'll get further?
If you don't know how to start, make at least a small diagram of pseudocode that show that you've tried it, try to get information on how to program in java, editors that you can need...
Prepare good questions when you need help (It is important that readers understand properly wehat you need if you want to receive help)...

If you follow those advices then you will enjoy the lounge, forums, articles and other sections here.

Welcome and remove this question as soon as possible before getting so downvoted that you become excluded from this wonderful community.
Joan Murt 31-Aug-12 10:15am

The best you can do ALWAYS with any program you need to do is:
- try to divide the problem in parts.
- make a small flowchart using paper and a pencil.
- implement little by little the previously identified parts.
- compile often.
- use the debugger (the greatest friend of you (real close to google)).

You'll get it for sure.

Start here: "http://java.sun.com/new2java/programming/learn/"

Rate this:

## Solution 1

Posted as a solution to removed this from the unanswered list and it is an answer, of sorts.
"Please submit .java source code files and screen captures." ... no thanks. I did my homework when I was in school. I do not feel a need to do yours for you.
Member 9396865 31-Aug-12 10:01am

I am just having trouble starting these programs
Rate this:

## Solution 2

You literally cut and pasted your homework on here and didn't even have the courtesy to format it correctly..

I'm feeling nice so I will help you, not going to do your homework for you though. You will need the modular to figure out the remainder of eggs.
"%"
x % 10 for example if x = 27, x%10 will give you 7, because 27 / 10 leaves 7 over.
Member 9396865 31-Aug-12 10:00am

sorry I forgot to ask the question going with this. I am having trouple with what to start with.
ModestMonk 31-Aug-12 10:12am

Have they taught you how to compile an application yet? Have you built a simple hello world? If you have, start there but remove the hello world portion.

Next you'll have to add the part that takes the user's input for number of eggs.

Then you'll have to output the results using % that I talked about to get the remainder as well as output the other feilds.

Easiest way to start is to break down the application into steps, and do them one step at a time. It may seem complicated but if you break them down you can accomplish small tasks one at a time and you will eventually accomplish the entire thing.

Top Experts
Last 24hrsThis month
 Richard MacCutchan 140 CPallini 125 ppolymorphe 105 OriginalGriff 89 Jon McKee 75
 OriginalGriff 2,413 ppolymorphe 1,371 Peter Leow 1,064 CPallini 806 John Simmons / outlaw programmer 770