Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

help with design of program newbie to java

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a frist time programmer of java and I have this program to write for one of my business classes and I would like some advice on how I should go about tackling it. the criteria is as follows users are to input their preferences, then search a data file to match the fit of the users input.
by >=80% . output should be Make, Model,Type,Retail price, Safety rating,miles per gallon, fit and to calculate the fit use this given weights:
Suggested Retail Price=.40
Safety Rating = .45
Miles Per gallon=.15
then their are 3 levels of fit.
With in 10% of preference: fit would be 100%
with in 20% of preference : fit would be 50%
above 20% of preference : fit would be 0%
My troubles is how should I go about starting this? any advice would be helpful thanks.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
zippythefile,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
buckaroo
Posts: 401
Postgres Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's see; the car's sugested retail is forty cents and it has a 1:2.22 chance of being safe and gets 1/7 of a mile per gallon.... My guess is that you shouldn't buy; I don't know - it's just a guess.
Why don't you try putting something together and show what you have while asking for help or ideas. I doubt anyone is going to write it for you... I don't know - it's just a guess.
First you need a means of querying your user and storing the results in a list or array which the main( String[] args ) does for you. What would be your unique identifier: Make, Model, Type? Or a composite?
Then you need to query your data file one record at a time, by Make, Model, Type?. Make your args[ i ] comparisons and print out the results.
This is an over simplification. But it is what you need to do to begin. Write the steps out in long hand first then convert your psuedo code into code.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I might humbly suggest that you check out Jess, a Java rule engine; Jess is good for writing programs like this.
 
Eric Johns
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Donald R. Cossitt:
Let's see; the car's sugested retail is forty cents and it has a 1:2.22 chance of being safe and gets 1/7 of a mile per gallon.... My guess is that you shouldn't buy; I don't know - it's just a guess.
Why don't you try putting something together and show what you have while asking for help or ideas. I doubt anyone is going to write it for you... I don't know - it's just a guess.
First you need a means of querying your user and storing the results in a list or array which the main( String[] args ) does for you. What would be your unique identifier: Make, Model, Type? Or a composite?
Then you need to query your data file one record at a time, by Make, Model, Type?. Make your args[ i ] comparisons and print out the results.
This is an over simplification. But it is what you need to do to begin. Write the steps out in long hand first then convert your psuedo code into code.


I should I posted this statement as well but this applys for anybody who replys to this post!!!
I don't want somebody to write it for me I just wanted some suggest or just to point in a good direction start, because I really have never done any programing before.
 
Donald R. Cossitt
buckaroo
Posts: 401
Postgres Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


First you need a means of querying your user and storing the results in a list or array which the main( String[] args ) does for you. What would be your unique identifier: Make, Model, Type? Or a composite?
Then you need to query your data file one record at a time, by Make, Model, Type?. Make your args[ i ] comparisons and print out the results.
This is an over simplification. But it is what you need to do to begin. Write the steps out in long hand first then convert your psuedo code into code.

 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the display name change.
My troubles is how should I go about starting this?
I suppose you've a few different issues to consider, including learning some new technologies and skills.
Since you say you have never done any programing before, then you might appreciate the following list of free on-line Java tutorials and books that I have found useful:
  • Sun's Java Tutorial
  • Introduction to Computer Science using Java by Bradley Kjell
  • Introduction to Programming Using Java by David J. Eck
  • Dick Baldwin's Java Programming Tutorials
  • Interactive Programming In Java by Lynn Andrea Stein
  • Bruce Eckel's Thinking In Java

  • Then, you might want to consider how you want the users of your application to use it. Will it be a web application and users will visit a web site with a web browser to use it? Will it be an Applet? Will it be a desktop application? Will it be a MIDP app for use on a cell phone?
    If you've got the time, I'd suggest starting with a nice and simple console based application. The app can print questions and information to a command prompt and get responses from the user through a command prompt, as well. Later, if you want to get fancy, step into a GUI with an AWT or Swing-based interface.
    If you're developing a web application, then I'd still suggest considering starting with a console application, before moving into Servlets. (Swing and AWT GUI technologies could easily be skipped.)
    For the basics on creating a console application, check out Sun's First Cup of Java trail in the tutorial link above.
    And of course, hang out at the Ranch! This is always a good place to ask questions and get some great answers. And when asking folks a question, taking a minute to first explain things to your Cardboard Analyst and to think about Asking a Good Question is time well spent.
     
    Eric Johns
    Greenhorn
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    ok I sat down and worked on it the one problem I'm having now is when I'm quering my data how do I provent the fields Make,model,Type not to appear when Retail price, safety rating, and miles per gallon don't fit my criteria? Thanks Eric

    My code up to Quering the Data file:
    CarDataList carDataList=new CarDataList();
    int listSize=carDataList.getListSize();

    System.out.println("Cars that match your requirements with at least 80% fit:");

    for (int i=0; i<listSize;i++)
    {
    CarData carData=carDataList.getCar(i);

    make=carData.getMake();
    model=carData.getModel();
    type=carData.getType();

    System.out.println("Make:"+ make);
    safetyRating=carData.getSafetyRating();

    if (inputSafetyRating<= 1.1 * safetyRating)
    {
    sfit=100;
    System.out.println("Safety Rating:"+ safetyRating);

    }

    else if (inputSafetyRating<= 1.2 * safetyRating)
    {
    sfit=50;
    System.out.println("Safety Rating:"+ safetyRating);


    }


    }//End of Loop
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic