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);
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;
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();
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 .
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.
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.
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
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
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 :
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++)
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");
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?