Rock Paper Scissors Repeat Itself 10x
Feb 18, 2014
I was wondering how I could make this code for rock paper scissors repeat itself 10x
import java.util.Scanner;
import java.util.Random;
public class Rock {
public static void main (String [] args) {
[Code] .....
View Replies
ADVERTISEMENT
Jan 3, 2015
im trying to modify the class to include a playerName variable and methods named assignName and getName. The assignName() method has a String parameter name that is assigned to playerName. The getName() method has to return the value of playerName.the problem i have when i run it is that it says there is a problem in the
public static String getName(){
return getName();
but im not sure what it is, this is all of my code:
public class RPS1 {
public static void main(String[] args) {
RPSGame rps = new RPSGame();
RPSPlayer rpsOpponent = new RPSPlayer();
int playerThrow;
Scanner input = new Scanner(System.in);
[code]....
View Replies
View Related
Nov 7, 2014
When I try to compile the code it says " method determineWinner in class RPS cannot be applied to given types;" I think there is something wrong with the way i called the determineWinner method but i'm not what exactly is wrong.
public class RPS
{
public static void main( String [] args )
{
String result;
String userName = getUserName();
String playerChoice, computerChoice;
[code]....
View Replies
View Related
Jun 23, 2014
I am trying to program a game of RPS.
View Replies
View Related
Nov 7, 2014
When I try running the program it wont output the determineWinner method, I think there is something wrong with the way i called results. But I am not exactly sure?
public class rpsGame
{
public static void main( String [] args ) {
String userName = getUserName();
String playerChoice, computerChoice;
computerChoice = getComputerChoice();
[Code] ....
View Replies
View Related
Mar 31, 2014
I have created a program that will take in input of paper names and authors. The next step of the program is to make references from paper to paper, and be able to add as well as list those reference, and i am lost as to where to go.I currently hold my instances of my paper class (the different papers I have stored) in a hash map. With the title being the key.
Is there a method as to where I can link keys? Do i need to use a seperate data structure? Or maybe add a new attribute to the paper class? I have attached the program as a zip file, If you open the zip file then its the methods in the Research SupportApp class .
View Replies
View Related
May 2, 2014
I am having trouble while printing out form. So far I have succeeded to print it out.But my question is that I want jpanel to print out in Landscape rather then portrait.
View Replies
View Related
Feb 7, 2009
I am using ui:repeat tag to iterate over a list. Now in that I need to do some processing based on the current iteration index like we have in a normal for loop. I have to do some processing based on the current iteration index. How can I get that.
View Replies
View Related
Aug 19, 2014
i have a client side program that grabs information about the computer it runs on. I want to have it grab the same info every so often, and check it against the original.
what can be used to do something like that? end game would be having it start up with the pc, then check periodically. if the values are different, send them to the database
View Replies
View Related
Feb 7, 2015
I have done a rock, paper, scissors program, but it only executes once. How do I make the program repeat so you can play multiple times?
import java.util.Scanner;
import java.util.Random;
public class RockPaperScissors {
public static void main(String[] args) {
int A;
Scanner input = new Scanner(System.in);
Random random = new Random();
[code]....
View Replies
View Related
Jun 28, 2014
the number of lines that can be printed on a paper size, the point size of each character in a line, whether lines are double-spaced or single-spaced,the top and the bottom margins of the paper. assume that all characters are of the same point size, and all lines are either single-spaced or double-spaced. note that 1 inch = 72 points. make over, assume that the line are pointed along the width of the paper. for example, if the length of the paper is 11 inches and the width is 8.5 inches,then the maximum length of a line is 8.5 inches.write a program that calculates the number of characters in a line and the number of lines that can be printed on a paper based on following input from the user.
a.the length and width, in inches, of the paper.
b.the top, bottom, left, and right margins.
c.the point size of a line.
d. if the lines are double-spaced, then double the point size of each character
View Replies
View Related
Oct 8, 2014
I wanted to make a small program to move a small rectangle by pressing the WASD keys. The program works, except that when I hold a key to move the rectangle, after a second, auto-repeat starts up, and the rectangle motion accelerates. I want to prevent automatic repeat to activate, so that the rectangle moves at a constant speed when I hold a key and stops when I released. Here is the ButtonMotion classe :
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.KeyStroke;
[code]....
View Replies
View Related
Oct 10, 2014
Basically, I have want to keep typing numbers and pressing enter and the same program keeps repeating itself. This is the code I need to repeat,
import java.util.Scanner;
class Averagecalc2 {
public static void main(String args []) {
Scanner input = new Scanner(System.in);
double num,
[Code] .....
View Replies
View Related
Oct 27, 2014
Ii am trying run a do while loop on java a specific amount of times for example if i were to type in "Enter number of years" and enter 4. i need the loop to execute 4 times or if i said 6 times then i would be 6. the program i have repeats it and takes it back to reentering "Enter number of years" i need it to execute by its self x amount of times. here is what i have so far
System.out.println("Enter the number of years: ");
years = keyboard.nextInt();
rainfall = generator.nextInt(10) + 1;
System.out.println("Year " + "rainfall amounts were");;
for (int months = 1; months <= 12; months++)
[Code]...
View Replies
View Related
Feb 18, 2014
My question is how can I make the program repeat until the user enters the number 4 to exit?
/**
* Write an application for a furniture company; the program determines the price of a table. Ask the user to choose 1 for pine, 2 for oak, or 3 for mahogany. The output is the name of the wood chosen as well as the price of the table. Pine table cost $100, oak tables cost $225, and mahogany table cost $310. Also ask the user to specify a
(1) large table or a
(2) small table.
Add $35 to the price of any large table and add nothing to the price for a small table. Display the output. Your program must repeat until the user chooses to exit.
*/
import java.util.Scanner;
public class Wood {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.println ("Table Prices");
[Code] .....
View Replies
View Related
Apr 24, 2015
I am trying to write a Random Number Generator that will not contain any repeat value in a given range
something this I have try so far
import java.util.Random;
/**
* This class is used to generate a
* Range of Random Number in a range from int a to int b
*/
public class RandomNumberGenerator {
public static void main(String[] args) {
int[] arr=randomNummbers(1, 20);
for(int j=0;j<arr.length;j++){
[Code]...
although this code generate random numbers but some values are also getting duplicate.So how to write a program for random number that will not repeat any integer in range?
View Replies
View Related
Aug 11, 2014
This is what I have so far, but how do I ask the user for the number or rows and give the user the option to repeat the program?
public class Pyramid {
public static void main(String[] args) {
int myLevel;
int i, j , k;
myLevel = 6;
for (i = 1; i <= myLevel; i++) {
[Code] ....
View Replies
View Related