Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.suarez;
- import java.util.Scanner;
- /*
- Ryan Saqueton
- Looks for @ in an email address
- */
- public class Q62 {
- public static void main(String[] args){
- String email;
- Scanner scan = new Scanner(System.in);
- System.out.println("What is your email address?");
- email = scan.next();
- if (email.contains("@")) {
- System.out.println("Email address is valid");
- } else {
- System.out.println("Email address is invalid");
- }
- }
- package com.suarez;
- import java.util.*;
- /*
- Ryan Saqueton
- Converts decimal to binary
- */
- public class Q64 {
- public static void main(String[] args) {
- int n, count = 0, a;
- String x = "";
- Scanner s = new Scanner(System.in);
- System.out.println("Enter any decimal number:");
- n = s.nextInt();
- while (n > 0) {
- a = n % 2;
- if (a == 1) {
- count++;
- }
- x = x + "" + a;
- n = n / 2;
- }
- System.out.println("Binary number:" + x);
- }
- }
- package com.company;
- import java.util.Scanner;
- /*
- Ryan Saqueton
- Uses XOR to determine true or false
- */
- public class Q66 {
- public static void main(String[] args) {
- System.out.println("Input a binary number.");
- Scanner input = new Scanner(System.in);
- String URL = input.nextLine();
- int x = 0;
- int y = 0;
- while(URL.indexOf("1") != -1){
- URL = URL.replaceFirst("1","_");
- y = y+1;
- }
- while(URL.indexOf("0") != -1){
- URL = URL.replaceFirst("0","_");
- x = x+1;
- }
- if(x==y)
- {
- System.out.print("0 , False");
- }
- else
- {
- System.out.print("1 , True");
- }
- }
- }
- package com.suarez;
- import java.util.Scanner;
- package com.suarez;
- import java.util.Scanner;
- /*
- Ryan Saqueton
- Sees if HTML is Valid
- */
- public class Q68 {
- public static void main(String[] args){
- String HTML;
- char a = '<';
- char b = '>';
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter your HTML");
- HTML = scan.next();
- int length = HTML.length();
- char first = HTML.charAt(0);
- char last = HTML.charAt(length-1);
- if (first == a && last == b) {
- System.out.println("HTML is valid");
- } else {
- System.out.println("HTML is invalid");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement