Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Help me Im lost!!!!  RSS feed

 
Java Idiot
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hey guys, im a dumb girl in college and I am taking a java programming class. I am so lost. Do any of you boys know how i would go about doing something like these 3 problems??? Any sort of help would be AMAZING!!!

:

1. Use the ideas presented in Labs 4 and 5 to read and process information in a file about student grades. The file (called grades1.txt) contains the following entries for each student (each on its own line): Last Name, First Name, Quiz 1, Quiz 2, Quiz 3, Midterm, Final. The first and last name are strings, and the remainder of the values are integers. Here is an example:

Olivier

Laurence

85

89

87

79

89

A blank line (only a CR/LF) separates student entries.

Compute and print the name, total average, and letter grade for each student. The total average is computed as follows:

total = 0.4((quiz1 + quiz2 + quiz3)/3) + 0.3(midterm) + 0.3(final)

Assign letter grades on a 90=A, 80=B, 70=C, etc. scale. The output line for the values above would be:

Olivier Laurence 85.2 B



2. Modify the program in Question 1 so that it can read a new file (called grades2.txt) with all values for a given student on a single line. An example is shown below:

Olivier Laurence 85 89 87 79 89

The values on an individual line are separated by spaces. There are no blank lines in the file. The output should be the same as that for Question 1.


3. A neighborhood association organizes a car pool to bring the neighborhood children to school. Parents volunteer to drive some number of children up to the maximum that can be carried safely in their vehicle. Some parents own child car seats, and the association owns five car seats that it can distribute when needed. Eight children must be assigned to vehicles each week.

Write a program that first accepts the names of the eight children and whether or not they require a car seat. Next, your program should accept the name of a driver, the number of children they can transport, and the number of car seats they own. Your program should then assign children to a driver and indicate the number of car seats needed from the association. An example session is shown below:

Enter the child's and Y/N if a car seat is needed:

Fred Y

Ethel N

Ricky N

Lucy Y

Ralph N

Alice Y

Norton Y

Trixie N

Enter the name of the driver, available seats, and number of car seats owned:

Steve 3 2

Assigned to Steve: Fred Lucy Ethel ; Car seats: 0

Enter the name of the driver, available seats, and number of car seats owned:

Dano 4 1

Assigned to Dano: Alice Ricky Ralph Trixie ; Car seats: 0

Enter the name of the driver, available seats, and number of car seats owned:

Ben 2 0

Assigned to Ben: Norton ; Car seats: 1

All children have been assigned

Car seats remaining: 4
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

We don't do homework for people here at JavaRanch. What we do is to help them to learn Java. So, have you had any thoughts and ideas on these questions yourself? If so, tell us what they are, and what specific issues you have in moving forward. You'll need to start new threads for those, as I'm closing this one.
[ October 16, 2007: Message edited by: Ulf Dittmer ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!