Okay so I have to have write a program that takes website names until you type stop.
After that it should count how many websites were entered.
package website;
/**
*
* @author
*/
import java.*;
import java.util.Scanner;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int com = 0;
//It'll catch the website name here
System.out.println("Please enter a website name: ");
String url = scan.next();
int dotCom = url.indexOf(".com");
int stop = url.indexOf("stop");
while(!url.equals(stop))
{
if ( dotCom > 0)
com = com + 1;
System.out.println(com);
if (stop > 0)
{
System.out.println(com);
break;
}
}
}
}
Right now it just adds numbers and doesn't stop after you enter in a domain name.