Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java
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 3:27am
Edited 31-Aug-12 7:03am
v4
Comments
Wes Aday at 31-Aug-12 9:32am
   
"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__ at 31-Aug-12 9:32am
   
What have you tried ?
Joan Murt at 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 at 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: bad
good
Please Sign up or sign in to vote.

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.
  Permalink  
Comments
Member 9396865 at 31-Aug-12 10:01am
   
I am just having trouble starting these programs
Rate this: bad
good
Please Sign up or sign in to vote.

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.
  Permalink  
Comments
Member 9396865 at 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 at 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.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 435
1 Sergey Alexandrovich Kryukov 200
2 Yogesh Kumar Tyagi 180
3 Richard Deeming 180
4 RyanDev 115
0 Sergey Alexandrovich Kryukov 6,405
1 OriginalGriff 5,798
2 CPallini 2,473
3 Richard MacCutchan 1,647
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 31 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100