User Profile

Collapse

Profile Sidebar

Collapse
broception
broception
Last Activity: Mar 22 '13, 12:27 AM
Joined: Feb 25 '13
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • how to use if statement to choose from three choices

    I'm trying to get the user to enter what shift they worked, if they enter first shift then the pay rate would be 12.30, if they enter second shift pay rate is 14, and so on.
    What I have so far:

    Code:
    firstShift=12.30
    secondShift=14.20
    thirdShift=15.30
    tax = .28
    otMultiplier = .5
        
    def main():    
        name = getName()
        hrsWrkd = int(input("Enter hours worked: "))
    ...
    See more | Go to post

  • broception
    started a topic Counting how many letters and numbers
    in Java

    Counting how many letters and numbers

    I'm trying to count how many letters and how many numbers are in a user input string. For example:
    Number01: should display
    2 numbers
    6 letters

    So far, I've counted how many letters there are but I don't know how to add numbers to the string.

    Code:
    import javax.swing.JOptionPane;
    
    public class morePractice {
    
    	public static void main(String[] args) {
    		String str;
    ...
    See more | Go to post

  • how to do user input mix of numbers and letters using JOptionPane

    What i have so far.
    I'm trying to get it to where i can enter anything for example: lajflho142323kj lkhaf
    but the program blows up if i do a mix of letters and numbers

    Code:
    import javax.swing.JOptionPane;
    
    public class morePractice {
    
    	public static void main(String[] args) {
    		String str;
    		int num1;
    		
    		str=JOptionPane.showInputDialog("Enter phrase");
    ...
    See more | Go to post

  • broception
    started a topic Putting code in while or for statement
    in Java

    Putting code in while or for statement

    I been working on a program for class, and I finished it but I was wondering if I could put the code into a while statement to make it easier to read. If it's possible, can someone show me how?

    Code:
    import java.util.Scanner;
    
    public class Problem3 {
    
    	//*** User input amount then print out amount in fewest number of bills
    	
    	public static void main(String[] args) {
    		Scanner keyboard=new
    ...
    See more | Go to post
No activity results to display
Show More
Working...