Java assignment problem

I'm having a rele annoying problem with my java program i'm trying to write. My teacher has gave us classes to use for an assignment;
type.lib.ToolBox;
type.lib.CreditCard;
each time i import these classes in my main java program an compile it, i get an error, can anyone help me find a solution to this?

that is the error that i'm getting;
Credit.java:2: package type.lib does not exist
import type.lib.CreditCard;
^
Credit.java:3: package type.lib does not exist
import type.lib.ToolBox;
BELOW IS MY ACTUAL CODE
import java.util.Scanner;
import type.lib.CreditCard;
import type.lib.ToolBox;
public class Credit {
     public static void main(String[] args) {
     Scanner input = new Scanner(System.in);
     }

Similar Messages

  • Problem with Java assignment using StringTokenizer

    I am having trouble with a Java assignment. The objective is to take a user-defined sentence, split each word up, and put each word on a line. Then the program extracts the vowels and prints them to the end of the word in the order they appeared. The program, when properly done, looks like this:
    Enter a line of text: Early in the morning 'bout the break of day
    rlEay
    ni
    the
    mrnngoi
    'btou
    the
    brkea
    fo
    day
    I can't figure out how to take the vowels and put them at the end of the word. So far my code looks like this:
    import java.io.*;
    import java.util.*;
    class WordPlay
         public static void main (String[] args) throws IOException
              // ========================= //
              // Declaration of variables. //
              // ========================= //
              int               count;
              BufferedReader     keyboard;
              String               oneWord;
              String               sentence;
              String               spaces;
              String               vowels;
              StringTokenizer     words;
              // ================================== //
              // Introduction and user orientation. //
              // ================================== //
              System.out.print ("Enter a line of text: ");
              // ============================ //
              // Initialization of variables. //
              // ============================ //
              keyboard           = new BufferedReader (new InputStreamReader(System.in));
              sentence           = keyboard.readLine();
              spaces               = " ";
              words               = new StringTokenizer(sentence,spaces);
              // ================= //
              // Logic statements. //
              // ================= //
              while (words.countTokens() > 0)
                   oneWord          = words.nextToken();
                   vowels          = "A,a,E,e,I,i,O,o,U,u,Y,y";
                   count          = 0;
                   System.out.println(" " + oneWord);
    I know that I need to use a StringTokenizer method to break each word's characters up and extract the vowels, but I don't know the right way to do this. My instructor stated that the program uses 2 while statements and an if statement, in that order. Problem is that I don't know how to proceed from here. Can anyone point me in the right direction?
    Let me know if you want anything clarified. I apologize for the verbose code; my instructor doesn't let us take any shortcuts.

    Hey, thanks for replying, but I'm still confused about one thing.
    If I'm not mistaken, the program when executed takes each word that I separated with StringTokenizer and prints the consonants and then moves on. How can I get Java to store the vowels only for the amount of time needed to concatenate them to the end of the word? I would think a while loop would solve the problem, but as my code is set up, the sentence is tokenized to only words. How do I properly break down the words into characters? I would think that another StringTokenizer could do this, but it seems to me that one StringTokenizer will override the other one, yet I need each word separated as well.
    Can you offer any advice on that?

  • Java Session problem while sending mail(using javamail) using Pl/SQL

    Hello ...
    i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
    pls any help.

    props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
    Please format your code when you post the next time, there is a nice 'code' button above the post area.
    Mike

  • Java Programming Problem

    Hi all,
    I was looking for this java programming problem which had to do with a large building and there was some gallons of water involved in it too somehow and we had to figure out the height of the buiding using java. This problem is also in one of the java books and I really need to find out all details about this problem and the solution. NEED HELP!!
    Thanks
    mac

    Yes, it will. The water will drain from the bottom of
    the tank until the pressure from the water inside the
    tank equals the pressure from the pipe. In other
    words, without a pump, the water will drain out until
    there is the same amount of water in the tank as in
    the pipe The water pressure depends on the depth of the water, not the volume. So once the depth of the water inside the pipe reaches the same depth as the water inside the tank it will stop flowing. This will never be above the height of the tank.
    I found this applet which demonstrates our problem. If you run it you can drag the guy up to the top, when water in his hose reaches the level of the water in the tank it will stop flowing out.

  • Java Uninstall Problem

    Java Uninstall Problem
    This all came about because of a failed uninstall, using Your Uninstaller.
    The {Java runtime which is all I want) is not listed now & I tried all the other fix bad uninstall type features, all to no avail.} )
    When I DL & run the latest package (jxpiinstall-6u11-fcs-bin-b90-windows-i586-25_nov_2008.exe}
    & run it I get:
    1st message:
         "This software has already been installed on your computer.
         Would you like to install it?"
    If I say no, it exits.
    If I say yes, I get this second message:
         :This action is only valid for products that are currently installed."
    So Now I have no Java & have no idea what to do.
    Any help would be greatly appreciated.
    Thanks, Neuromancer23

    Sorry...after posting it i realized there was a more appropriate forum, of which it took quiet awhile to find.)
    Now that I know where to find the forum list I will never double-post again.
    I'll close the question if I can

  • Sun Java security problems

    Please any one tel me about Sun Java security problems
    with Desktop application

    Hi.
    If you're using SSGD 4.41, please download the Admin guide from here:
    http://docs.sun.com/app/docs/doc/820-4907
    There, at page #41 you'll find useful info concerning "Client Connections and Security Warnings".
    Hope this helps,
    Rob

  • OS X Lion - JAVA SCRIPT PROBLEM

    I recently updated from Snow Leopard to OS X Lion. Now I seem to have a JAVA Script problem. Where do I start fixing this issue. I have checked updates etc etc but it seems to be updated. However, when I login to my web site backend, I have a problem. Any advice please?

    Would you please write some more details? explain the problem and what web site backend you use. Thanks.

  • Im DROWNING! need help with a simple java assignment! plz someone help me!

    i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!

    You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
    1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
    2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
    3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
    4. Subtract this sum from the next highest multiple of 10.
    5. The difference should be equal to the 9th digit, which is considered the check digit.
    Example of validating S.I.N. 765932546
    1st digit 7
    2nd digit (6*2 =12 1+2=) 3
    3rd digit 5
    4th digit (9*2 = 18 1+8 =) 9
    5th digit 3
    6th digit (2*2 = 4) 4
    7th digit 5
    8th digit (4*2 = 8) 8
    Total 44 next multiple of 10 is 50
    50-44 = 6 which is the 9th digit
    Therefore the S.I.N. 765932546 is Valid
    ********* SIN Validation *********
    Welcome - Please enter the first number: 120406780
    Second digit value multiplied by 2 4
    Fourth digit value multiplied by 2 8
    Sixth digit value multiplied by 2 12
    Eighth digit value multiplied by 2 16
    Value derived from 6th digit 3
    Value derived from 8th digit 7
    The total is 30
    Calculated digit is 10
    Check digit must be zero because calculated value is 10
    The SIN 120406780 is Valid
    this is my assignemtn this is what i have! i dont know where to start! please help me!
    /*     File:     sinnumber.java
         Author:     Ashley
         Date:     October 2006
         Purpose: Lab1
    import java.util.Scanner;
    public class Lab1
              public static void main(String[] args)
                   Scanner input = new Scanner(System.in);
                   int sin = 0;
                   int number0, number1, number2, number3, number4, number5, number6, number7, number8;
                   int count = 0;
                   int second, fourth, sixth, eighth;
                   System.out.print("\t\n**********************************");
                   System.out.print("\t\n**********SIN Validation**********");
                   System.out.print("\t\n**********************************");
                   System.out.println("\t\nPlease enter the First sin number: ");
                   sin = input.nextInt();
                   count = int.length(sin);     
                   if (count > 8 || count < 8)
                   System.out.print("Valid: ");
         }

  • Need help for a java assignment

    i am having trouble with my java assignment, so i thought i will give it a try here and hope that i will get some help. ^^
    the method is to load a file and try to create an object out of it. but even though the sequence of loading is correct, the method still doesn't work. there is no error in compilation and the coding seems correct to me. help?
    the codes are below and if any other code is needed. ask me for it. =)
    public void saveToFile(String fileName)
    try
    File f = new File(fileName);
    PrintWriter p = new PrintWriter(f);
    p.println(fileName);
    p.println("***");
    for(int i =0; i<categories.length; i++)
    if(categories[i] != null)
    p.print(categories.getCatNum());
    Car[] x = categories[i].getListOfCars();
    for(int q=0; q<x.length;q++)
    if(x[q] != null)
    if(x[q] instanceof EconomyCar)
    p.print("Economy Car");
    x[q].getCarNum();
    x[q].getBrand();
    x[q].getPrice();
    else if(x[q] instanceof LuxuryCar)
    p.print("Luxury Car");
    x[q].getCarNum();
    x[q].getBrand();
    x[q].getPrice();
    else if(x[q] instanceof SportCar)
    p.print("Sport Car");
    x[q].getCarNum();
    x[q].getBrand();
    x[q].getPrice();
    p.println(x[q].getCarNum());
    p.println(x[q].getBrand());
    p.println(x[q].getPrice());
    p.close();
    catch(IOException e)
    System.out.println("IO Error");
    public void loadFromFile(String fileName)
    try
    File file = new File(fileName);
    Scanner sc = new Scanner(file);
    String shopName = sc.nextLine();
    CarMart Cm = new CarMart(shopName);
    while(sc.hasNextLine());
    String line = sc.nextLine();
    while(line.equals("***"));
    int CateNum = sc.nextInt(); sc.nextLine();
    Category Cate = new Category(CateNum);
    String typeOfCar = sc.nextLine();
    if(typeOfCar.equals("Economy Car"))
    String CarNum = sc.nextLine();
    String brand = sc.nextLine();
    double price = sc.nextDouble(); sc.nextLine();
    EconomyCar e = new EconomyCar(CarNum, brand, price);
    else if(typeOfCar.equals("Luxury Car"))
    String CarNum = sc.nextLine();
    String brand = sc.nextLine();
    double price = sc.nextDouble(); sc.nextLine();
    LuxuryCar l = new LuxuryCar(CarNum, brand, price);
    else if(typeOfCar.equals("Sport Car"))
    String CarNum = sc.nextLine();
    String brand = sc.nextLine();
    double price = sc.nextDouble(); sc.nextLine();
    SportCar s = new SportCar(CarNum, brand, price);
    sc.close();
    catch(FileNotFoundException a)
    System.out.println("Filename not found");

    morgalr wrote:
    erm. its supposed to save a file containing all the data of a car. then the loadFromFile method is supposed to load that file and create a car out of it.I want one, could you please make mine a Dodge Viper.A fascinating insight into your secret worries about your masculinity :)

  • Some java object assignment problem

    Hi,
    here is some code ---
    class point
    int x;
    getx(){
    return x;
    setx(int x)
    this.x = x;
    class Immutable {
    private point p;
    getp(){
    return p;
    setp(point p)
    this.p = p;
    Immutable nn = new Immutable();
    i have to assign p.x=-5; without touching setp() method
    please help me
    im_kumar_mohan: tell me answer and how can i solve

    What's the problem - the immutable wrapper is not doing what it's name is recommending anyway:
    nn.getp.setx(-5)should do exactly, what you want to have.

  • Java threading problem... threads only work on 1 processor

    I've got a iterative deepening problem that i have to parallelize. As far as i know i did everything correctly however everything seems to be running on 1 processor instead of 2 processors. As far as i know i am using threads (-Xprof either defines them as thread-1 thread-2 or pool1-thread1,depending on the method used for issueing)
    the worker thread is:
    public int solutionsT(Board board, int currentDepth) {
            int temp = 0;
            int result = 0;
            if (board.distance() == 0) {
               return 1;
            if (board.distance() > board.bound()) {
                return 0;
            Board[] children = board.makeMoves();
            result = 0;
            for (int i = 0; i < children.length; i++) {
                if (children[i] != null) {
                    temp = solutionsT(children, currentDepth + 1);
    if(temp != 0){
    result += temp;
    return result;
    public void run() {
    int temp =0;
    int i = 0;
    while(true){
    while(bag.size() !=0){
    bag.putSolution(solutionsT(bag.get(),1));
    try{   
    barrier.await();
    }catch(Exception e){}
    it get's it's input from a bag that is filled before the iteration begins. (once the bag is filled it trips a barrier) this worker thread is a implementation of Runnable
    This piece of code is used to make the thread object and to issue it
    public SolutionThread(int numberOfThreads) {
       thread = numberOfThreads;
       bag = new bagOfBoards();
       barrier = new CyclicBarrier(thread+1);
       if(thread > 1){
          ExecutorService threadExecutor = Executors.newFixedThreadPool( thread );
          solution = new ThreadTest[thread];
          bag = new bagOfBoards();
          for(int i = 0;i<thread;i++){
             solution[i] = new ThreadTest(bag, lock, barrier, i);
             threadExecutor.execute(solution);
    finally this is the code which is used to acces the bag and get a board.
    synchronized public Board get() {
                if (size > 0) {
                size--;
                Board result = bag[size];
                return result;
            } else {
             return null;
        }since this method is synchronized and it always returns something (either null or a board) and the worker tests for this. there is no race condition here.
    furter more. the main thread is a loop. It fills te bags with an intial state. then it trips the barrier and waits for the workers to do the work. the workers then process the bag until it hits zero and then trip the barrier so that the main thread can do the next iteration (and fill the bag)
    p.s. i know the code is a bit messy, but i want to get the threading to work. As of now i relaly don't understand why the threads are just running on 1 processor instead of 2 processors. not only that. the excecution time is nearly the same as that of a sequential equivalent.
    p.s.2 the code is parallisable. and it is run on a smp system.
    Message was edited by:
    jstrike

    i'm very sure that the jvm and os support smp. the
    problem really should be in the code.I don't see how this can be the case. There's nothing in the Java language that deals with how threads are assigned to processors (at least not as far as I know) so there isn't anything you can do in your code to affect that.
    Or did you meant that i have to tell the jvm in the class that
    there is support for multiple processorsThat would be the only possibility. I have no idea whether it can be done or not, though.

  • JDBC Java- mysql problem help!

    Hi, I wnat to connect to mySQL fromo Java, I followed all the instructions from the mySql web page, yet I havent been able to do it, when I compile the java progrm I keep getting class not found exceptions, I am using Fedora Core and Java was already installed-well I chose to install it when I installed the operating system, the point is that the paths are all assigned by he system not by me.
    WHat can I do?, Ive been trying over andover again with no results, hopefully somebody can help, I tried to include all the configuration in this email,
    thank you
    my java program is the following:
    t.java
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class t {
    public static void main (String[] args) {
    System.out.println("Hello, world!\n");
    Class.forName("com.mysql.jdbc.Driver");
    when I javac t.java
    I have the following error
    4. ERROR in t.java
    (at line 11)
    Class.forName("com.mysql.jdbc.Driver");
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Unhandled exception type ClassNotFoundException
    when I comment out the Class.forName the hello world rogram runs fine
    when I vi /etc/java java.conf this is the result
    # System-wide Java configuration file -- sh --
    # JPackage Project [www.jpackage.org]
    # Location of jar files on the system
    JAVA_LIBDIR=/usr/share/java
    # Location of arch-specific jar files on the system
    JNI_LIBDIR=/usr/lib/java
    # Root of all JVM installations
    JVM_ROOT=/usr/lib/jvm
    # You can define a system-wide JVM root here if you're not using the default one#JAVA_HOME=$JVM_ROOT/java-gcj
    # Options to pass to the java interpreter
    JAVACMD_OPTS=
    ~
    [root@localhost test]# echo $PATH
    /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
    echo $JAVA_HOME
    it contains nothing
    ls /usr/share java*
    java
    java-1.3.0
    java-1.4.0
    java-1.4.1
    java-1.4.2
    java-1.5.0
    javadoc
    java-ext
    java-utils
    mysql-connector-java-3.1.13-bin.jar is under
    /usr/share/java
    in /etc/profile I have:
    export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java-3.1.13-bin.jar
    in /root/.bash_profile i have
    CLASSPATH=/usr/share/java/mysql-connector-java-3.1.13-bin.jar:/usr/lib/java-ext/mysql-connector/mysql-connector-java-3.1.13-bin.jar
    export CLASSPATH
    when I echo $PATH i have
    /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

    Thanks duff,
    The driver seems to be found
    when I run
    public class t {
    public static void main (String[] args) {
    try
    System.out.println("Hello, world!\n");
    Class.forName("com.mysql.jdbc.Driver");
    System.out.println("MySQL Driver Found");
    catch (ClassNotFoundException e)
    System.out.println("MySQL Driver NOT Found");
    e.printStackTrace();
    I feel somehow ive been focusing in the wrong side of the problem due to my ignorance in Java. Please help me to understand, the reson for which ithe runtime was telling me that there was an unhandled exception was because it is a requirement to handle all exceptions of this kind? why wouldnt it cmplain if I jst did the hello world without any exception handling, maybe because it is a requirement in the Class.forName...
    the other question is, is the message I was obtaining completely independent of the fact that the class was or was not found?
    Maybe, I should go with these questions to the newbies forum...
    thanks

  • BPEL Variable Assign Problem

    I had developed a Web Services with 2 methods:
    1, return XML data in string datatype
    2. return XML data in Element
    Both are work fine in normal web services invocation. However, when I try to invoke them in BPEL, I got trouble on them.
    For Method 1, I can succeed to call the web services and got the data back, but when I try to assign the XML to other variable (use the result xml xsd to create). It only assigned the whole XML data into the first element of XML such that I cannot further process the data by transformation.
    For Method 2, the BPEL enginee failure on compile the project as the enginee reported cannot regonize the "xsd:any" datatype in the invoking web services.
    any guys have idea about it? Thanks

    Hi,
    i had some problems too using xsd:any in the past.
    Check out xsd:anyType.
    A good article on this topic is:
    http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index.html
    Greets Jens

  • Adobe Dreamweaver CS5.5 - Windows 7 - Java Script Problem

    I am having trouble with Anchor.htm.
    When I try to insert an anchor in the text (Insert > Named Anchor> I get this error message:
    "While executing insertObject in Anchor.htm a Java Script error occurred."
    I recently downloaded both the 32- and 64-bit Java Script applications when I received a message that the existing version of Java Script was out-of-date. Anchor.htm worked before I installed the update.
    The files I downloaded and installed are:
    jre-7u9-windows-i586.exe
    jre-7u9-windows-x64.exe
    Please can anyone help me with this problem?

    From Dreamweaver FAQ
    http://forums.adobe.com/thread/429114
    "If Dreamweaver is acting erratically, or if you see a message saying "the following JavaScript error(s) occurred",  it's usually a sign of a corrupt cache file. The first thing to try should always be to delete the file cache. If that doesn't work, delete your personal Configuration folder. Full instructions are in Deleting a corrupted cache file.
    http://forums.adobe.com/thread/494811"
    Nancy O.

  • Java application problem

    I am using JDK1.4 and working on Windows Xp.
    I have written a code for application in java as follows:
    import javax.swing.*;
    public class sample
    JPanel panel;
    static JFrame frame;
    JButton but;
    public sample()
    frame=new JFrame("frame");
    panel=new JPanel();
    frame.getContentPane().add(panel);
    but=new JButton("click");
    panel.add(but);
    public static void main(String args[])
    sample s=new sample();
    frame.setSize(300,300);
    frame.setVisible(true);
    on executing program application window has appeared and it ran properly.
    Then I closed that application window.But after that in command prompt window curser was just blinking and it was not allow to enter also.
    I have tried pressing CTRL+C also.But situation in command prompt was same i.e curser in command prompt was just blinking.
    Then I closed cmd window ;but one error has occured saying that cmd window can not close .
    My friend has told me that she is also having windows xp and JDK1.4 ; ctrl+c is working properly in her command prompt.She has written the above same code in her computer and it executes properly.
    Even though she has not written following statement:
    "frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);"
    when she exits from application window ,her cmd window gave same problem of only blinking curser.But when she press CTRL+C ; her command prompt starts responding by giving root.But my command prompt is not giving
    positive responce to "ctrl+c" when I am exiting java application.
    Is it possible to solve this problem without giving statement
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ?
    Why my command prompt is not responding to CTRL+c?
    How can I tackle this problem ?
    Is there any other key which can be used in command prompt of Windows Xp?

    Is it possible to solve this problem without giving
    statement
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ?this is because Swing have started some non-daemon helper threads for its internal purposes and the default close operation for frame is just HIDE_ON_CLOSE. So, the system will not exit because those non-daemon thread still not terminated.
    What is the problems setting the default close operation to JFrame.EXIT_ON_CLOSE ?

Maybe you are looking for

  • Writing a file to a remote location (not KM) using WD

    Hello everyone. I've encountred a scenario in which I need to upload an excel file to a km file and also load it into the sap system. I've managed to upload the file to the KM Server, but not I have a new problem: The abap function that loads the exc

  • Printing on a shared printer on a network Windows PC

    I've successfully located and added a Brother HL-1030 laser printer attached to Windows PC on my Linksys network. When I added it, Generic printer driver was selected. Brother doesn't have a Mac driver for my model on its site. The problem is that wh

  • I need to understand better, what can be done with sync and what cannot

    i setup 2 windows boxes + 2 linux boxes to sync and got a mess in less than a day. apparently, i do not understand, what it does/should do, and what not. As one having done work in distributed environments, namely in database replication scenarios, i

  • Problem with NEF thumbnails in Bridge

    Hi there, Currently my NEF files in Bridge are showing up very small and not increasing in size when I adjust the zoom. I can see the image, it just stays small. I've tried to install the latest Camera Raw Plug-in (5.3), but that does nothing to help

  • Webservice for File Scenario

    HI Everyone,      Can i develop a webservice using .net platform for a file to file scenario using XI. How do i proceed. I know how to configure file to file scenario using XI, but how shd i replicate the same scenario as webservice. Any valueable in