Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can Some Compile Something For Me...?

Posted on 1998-05-07
12
Medium Priority
?
172 Views
Last Modified: 2013-11-23
I need someone to compile something for me as my sysadmin still has not installed the JDK on the UNIX machine.  Anyone who has the JDK either email me here:

aslan@yeat.ml.org

Or leave you answer as an answer on here.  Also can someone improve on this game I have, the one that needs to be compiled?  Like make it keep score, choose which di you want to keep and roll the other one; also turn it into Java 1.1?  Here is the code below:

import java.awt.*;
import java.awt.event.*;

/*
 *
 * This script was coded by Michael Lauzon, (C) 1998.
 * And not to be used without the express written
 * consent of its author: ce940@freenet.toronto.on.ca
 *
 */

public class Craps extends java.applet.Applet implements ActionListener {
  Die die1 = new Die();
  Die die2 = new Die();
  int wins = 0;
  int losses = 0;
  int point = 0;
  final String WINNER = "Winner!";
  final String LOSER = "Craps!";
  String resultText = "";
  Button rollButton = new Button("Roll Dice");

  public void init() {
    setBackground(Color.green);
    rollButton.addActionListener(this);
    add(rollButton);
  }

  public void paint(Graphics screen) {
    die1.drawDie(screen, 5, 50);
    die2.drawDie(screen, 175, 50);
    screen.setColor(Color.black);
    Font f = new Font("Times New Roman", Font.BOLD, 15);
    screen.setFont(f);
    if (point != 0) {
      screen.drawString(point + " wins and 7 craps out.", 5, 200);
    } else {
      screen.drawString("7 or 11 win; 2, 3, or 12 crap out.", 5, 200);
    }
    screen.drawString("Number of wins: " + wins, 5, 220);
    screen.drawString("Number of losses: " + losses, 5, 240);
    if (resultText != "") {
      f = new Font("Times New Roman", Font.BOLD, 30);
      screen.setFont(f);
      screen.drawString(resultText, 85, 110);
      resultText = "";
    }
  }

  public void actionPerformed(ActionEvent event) {
    die1.rollValue(6);
    die2.rollValue(6);
    checkResult(die1, die2);
    repaint();
  }

  public void checkResult(Die d1, Die d2) {
    if (point == 0) {
      point = d1.value + d2.value;
      if ( (point == 7) | (point == 11) ) {
        resultText = WINNER;
      }
      if ( (point < 4) | (point == 12) ) {
        resultText = LOSER;
      } else {
        if (d1.value + d2.value == point) {
          resultText = WINNER;
        }
        if (d1.value + d2.value == 7) {
          resultText = LOSER;
        }
      }
      if (resultText == WINNER) {
        wins++;
        point = 0;
      }
      if (resultText == LOSER) {
        losses++;
        point = 0;
      }
    }
  }
}


Thanks for any help you can give me.
0
Comment
Question by:CyberMage
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 

Expert Comment

by:java_kevin
ID: 1220750
I think yours is similar or same as
http://homer.pacific.net.sg/~thheugene/craps.html

maybe u can just obtain the class form here?
0
 

Expert Comment

by:java_kevin
ID: 1220751
I think yours is similar or same as
http://homer.pacific.net.sg/~thheugene/craps.html

maybe u can just obtain the class form here?

Otherwise, u need to include the source for Die class too. Else, we have to make those lines into comments
0
 

Author Comment

by:CyberMage
ID: 1220752
Well, if it is the same...God only knows why; is there anyway you  can make it keep score and stuff (make it more flavourable)?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:java_kevin
ID: 1220753
Maybe someone infringed the copyright laws... hehe

I can make it keep scores. They will be kept according to your requirements. And the results can be shown in some special/nice way. Bars, graph...etc

But to compile them properly, I need the Die class too. Else there'll be compile errors. Mind sending them to determined@mariah-carey.com ? The .java

Pls send them ASAP to compile. If after compilation, u have any problems, free to ask mi.

Although I started applet only this yr, I'll try to help.

Anyway, if u want, u can down JDK from www.javasoft.com and kawa (IDE for java) www.tek-tools.com . Pay attention to kawa's compatibility for jdk's version.
0
 

Expert Comment

by:java_kevin
ID: 1220754
I noticed that you didn't import java.applet.Applet.

i use jdk 1.1.5

You need to send me the .java of Die class ASAP to get everything right. I noticed that you have some syntax errors.
How long have u been doing java?
0
 

Author Comment

by:CyberMage
ID: 1220755
I haven't been doing Java long, and I can't use the JDK...as the sysadmin has yet to install it; once he figures out how.  I'll send you the Craps.java as soon as I can.
0
 
LVL 4

Expert Comment

by:evijay
ID: 1220756
No.

0
 

Expert Comment

by:java_kevin
ID: 1220757
How? Found the craps and die.java?
Been a long time already...
0
 

Author Comment

by:CyberMage
ID: 1220758
Craps.java is the whole Java program, there is nothing else to
it...WYSIWYG.
0
 

Expert Comment

by:java_kevin
ID: 1220759
Sorry, I actually mean the die.java...
I didn't receive the die.java yet...

If no die.java, errors will be many...maybe i try to do a basic die.java to compile and see any errors. try to send die.java ASAP. thanks.

Any errors, i solve then after get .class, will make those additional lines into comments so u can see.
0
 
LVL 1

Expert Comment

by:vijayakumar
ID: 1220760
Can you attach Die.java for me so that i can compile for you
0
 
LVL 5

Accepted Solution

by:
fontaine earned 200 total points
ID: 1220761
No need to wait for your sysadmin waking up ;-).
Go here, this is an on-line compiling service:

http://www.innovation.ch/java/java_compile.html
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question