7 Replies - 645 Views - Last Post: 01 December 2017 - 04:04 PM Rate Topic: -----

#1 DumbProgrammer01   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-November 17

Account Setup

Posted 30 November 2017 - 12:53 PM

it wont change the username and password to lowercase letters. and the password should have at least 8 characters


 import java.util.Scanner;
 import java.lang.String;
public class AccountSetup {
    
    public static void main(String[] args) {
    	
    	// TODO, add your application code
    	System.out.println("Written By: Areion Simien");
    	String phase, eightLetters;
    	int user;
    	int pass;
    	Scanner input = new Scanner(System.in);
    	
    	System.out.print("Enter a username: ");
    	phase = input.nextLine();
    	 for(int i = 0; i<=8; i++)
    	 {
    	 	System.out.print("Enter a password that is at least 8 characters: ");
    	 	
    	 }
    	
    
    	
        
    	
    }
}
:code:

This post has been edited by modi123_1: 30 November 2017 - 12:57 PM
Reason for edit:: In the future, please use the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: Account Setup

#2 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3550
  • View blog
  • Posts: 16,190
  • Joined: 20-September 08

Re: Account Setup

Posted 30 November 2017 - 12:57 PM

What is your question?
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14095
  • View blog
  • Posts: 56,486
  • Joined: 12-June 08

Re: Account Setup

Posted 30 November 2017 - 12:57 PM

Where are you asking for user input for those variables?
Was This Post Helpful? 0
  • +
  • -

#4 DumbProgrammer01   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-November 17

Re: Account Setup

Posted 01 December 2017 - 12:11 PM

View Postg00se, on 30 November 2017 - 07:57 PM, said:

What is your question?

How would i make the username and password as lowercase letters?
Was This Post Helpful? 0
  • +
  • -

#5 ndc85430   User is online

  • I think you'll find it's "Dr"
  • member icon

Reputation: 826
  • View blog
  • Posts: 3,340
  • Joined: 13-June 14

Re: Account Setup

Posted 01 December 2017 - 12:34 PM

Perhaps you should look at the Java API documentation to see which methods you can call on String.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14095
  • View blog
  • Posts: 56,486
  • Joined: 12-June 08

Re: Account Setup

Posted 01 December 2017 - 12:36 PM

View PostDumbProgrammer01, on 01 December 2017 - 01:11 PM, said:

View Postg00se, on 30 November 2017 - 07:57 PM, said:

What is your question?

How would i make the username and password as lowercase letters?

Wait, what? User and Password are integers. There is no lower case integers.

10        int user;
11        int pass;

Was This Post Helpful? 1
  • +
  • -

#7 NeoTifa   User is offline

  • NeoTifa Codebreaker, the Scourge of Devtester
  • member icon





Reputation: 4213
  • View blog
  • Posts: 18,480
  • Joined: 24-September 08

Re: Account Setup

Posted 01 December 2017 - 12:47 PM

This is so bad on so many levels. First off, like Modi hinted at, scanner's nextLine is going to pass a string, which is what I think you want. Make your username a string. Same with password. For some reason, in that loop, all you're doing is printing "Enter a password that is at least 8 characters: " 8 times to the screen. You're not really doing any inputting here. What you should probably be doing is capturing the passoword, then doing validation on it after that. Or, if you want, you can probably grab it char by char and just chop off the rest of the stream. I don't know what your definition of password is. Is it all numbers, because then the int might work instead of string. You need to give more details. Hopefully clearing that up will at least get you started.

http://www.geeksforg...-class-in-java/

This post has been edited by NeoTifa: 01 December 2017 - 12:49 PM

Was This Post Helpful? 0
  • +
  • -

#8 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3550
  • View blog
  • Posts: 16,190
  • Joined: 20-September 08

Re: Account Setup

Posted 01 December 2017 - 04:04 PM

Quote

How would i make the username and password as lowercase letters?

You mean - how would i change the input into lower case? See String.toLowerCase
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1