Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner; // Needed for accepting input
- public class ProjectOneAndreD
- {
- public static void main(String[] args)
- {
- String input1;
- char coln = ':';
- int val=0, rad=0, answer=0, check1=0;
- Scanner keyboard = new Scanner(System.in); //creates new scanner class
- do
- {
- System.out.println("****************************************************");
- System.out.println(" This is Project 1. Enjoy! "); //title
- System.out.println("****************************************************\n\n");
- System.out.println("Enter a number, : and then the radix, followed by the Enter key.");
- System.out.println("INPUT EXAMPLE: 160:2 {ENTER} "); //example
- System.out.print("INPUT: "); //prompts user input.
- input1 = keyboard.nextLine(); //assigns input to string input1
- check1=input1.indexOf(coln);
- if(check1==-1)
- {
- System.out.println("I think you forgot the ':'.");
- }
- else
- {
- System.out.println("found ':'");
- }
- }while(check1==-1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement