File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes help with design of program newbie to java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help with design of program newbie to java" Watch "help with design of program newbie to java" New topic
Author

help with design of program newbie to java

Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
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.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
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.


doco
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

I might humbly suggest that you check out Jess, a Java rule engine; Jess is good for writing programs like this.


[Jess in Action][AskingGoodQuestions]
Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
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
Ranch Hand

Joined: Jan 31, 2003
Posts: 401

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

Joined: Dec 10, 2001
Posts: 7023
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

    Joined: Sep 13, 2003
    Posts: 20
    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
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: help with design of program newbie to java