Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Help in High School AP Computer Science PLEASE

    So my Teacher is pretty bad at teaching Java and my friends and I in the class are really struggling right now trying to figure out this what I imagine should be simple work out. JPG file is the worksheet. Any help is highly appreciated!

    This is all I have so far on BlueJ

    // 8/28/13
    // Period 1
    // Lab0101
    public class StringArt
    {
    public static void main (String[] args) {
    String s1= "$&$";
    String s2= "&$&";
    String s3= "$$$";
    String s4= "";

    int i1= 1;
    System.out.println ("Excellence");
    for (i1=1; i1<=12; i1++) {
    s4= s4+s1;
    System.out.println (s4);
    Attached Thumbnails Attached Thumbnails Help in High School AP Computer Science PLEASE-img_2046.jpg  

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,073
    Thanks
    38
    Thanked 498 Times in 492 Posts
    I can understand you struggles when you have no even posted to the right forum.
    This is the Javascript forum, not the Java forum.

    As when reading a test question, it is best to read all the words!

  • #3
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yeah I saw that but I thought maybe one of you would know because there are only like 5 people on the other forum and over 100 here I thought my chances would be better.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,125
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    For your first pattern, you are really only missing one thing: the } at the end of the for loop block.
    Code:
    for (i1=1; i1<=12; i1++) 
    {
        s4= s4+s1;
        System.out.println (s4);
    }
    And now you need to do that in reverse. And then do it for the other two patterns.

    And of course you need an ending } for your main( ) function and another for the class.

    You are very very close.

    One more hint: You don't need any more variables, at all. Just re-use the ones you have.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    alright we finished that part but we are struggling with the second part.


    Hello Please help

    I need help with my computer science homework. Can you just solve this for me in Java and do it with really basic code because I have only been in class for 2 weeks and done very little



    you have just won the acme lottery, but unfortunately you have to go collect your winning in person! Here are some facts-

    Number of Pennies in a 1 inch stack, 12
    Number of pennies side-by-side in 1 foot, 16
    Height of $1 bill, .0043 inches
    Length of $1 bill, 6 inches
    Width of $1 bill, 2.5 inches
    Weight of $1 million in $1 bills, 2203
    All bills of different amounts have the same dimensions and weight

    Create and implent a well-document class called AcmeLottery with a singl "main()" method to calculate and clearly output the following

    1.If you won a prized between 1,0000 and $15,000 (in increments of $1,000) to be pain in pennies, and you have a 2 foot by 2 foot box to hold them, how tall would your crate have to be for each amount? Let the computer do the calculations for you...

    2. IF you won between $100,000 and $250,000 ( in increments of $25,000) to be paid in $5 bills, how much do your winnings weigh for each amount?

    3. If you won between $1,000,000 and $10,000,000 (in increments of $1M) to be paid $20 bills, and you use your crate from above, how tall would your crate have to be? Assume your bills are lying flat in the crate (there may be a little space around the edges).

    4 Add other descriptive output statements and labels to your programs

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,125
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    First of all, look here:
    http://www.codingforums.com/rules.htm

    And read rule 1.5.

    I helped you with the first problem because you had indeed done most of the work yourself.

    But I am *NOT* going to *DO* homework for you, for the reasons noted in rule 1.5.

    Make an effort. Get close. Analyze the problem!!!

    Then post your efforts. *THEN* you can get help.

    Hint to get you started.

    Box is 2 feet by 2 feet. 16 pennies to the foot horizontally. 12 pennies to the inch vertically.

    Code:
    double penniesPerFoot = 16;
    double penniesPerSquareFoot = penniesPerFoot * penniesPerFoot;
    double penniesPerLevelInBox = penniesPerSquareFoot * 2 * 2; // 2 by 2 foot box
    double verticalPenniesPerInch = 12;
    double penniesPerVerticalInch = penniesPerLevelInBox * verticalPenniesPerInch;
    double dollarsPerVerticalInch = penniesPerVerticalInch / 100; // 100 pennies per dollar
    double inchesPerThousandDollars = 1000.00 / dollarsPerVerticalInch;
    Get the idea?

    Don't use dumb-assed names like p1, p2, i1, i2, etc. Use variable names that *DESCRIBE* what you are doing. It makes your program almost self-documenting.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Student1 (09-03-2013)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •