0
Can someone help me writing this code in java language please
Write a java program that read your first name and the first name of your friends then the program should compute and prints the percentage of your friends whose first names start with the same letter as your first name The program reads your friends name till the word stop is entered
6 Answers
+ 1
Mark G. Ghrayeb I just did what came to my mind. May be someone else will help you achieve it using what you want.
Anyways you're welcome.
+ 1
Public class Markjava {
Import java.util.Scanner;
Public static void main (String [ ] args) {
Scanner input = new Scanner (System.in);
String firstname = " " ;
String friendsname = " " ;
System.out.println("please enter your first name :") ;
Firstname = input.next();
do {
System.out.println("enter your friends name : ") ;
Friendsname = input.next();
Substring(0)
Friendsname=firstname
}
while
(!Friendsname.equals(STOP))
}}
Thats what i just did
Please note guys im just a beginner learner dont judge me, all the respect for you
0
Please, show us your efforts (share it in section "codes { }"
0
Since you said java, it is pretty simple to be honest.
Just give it an attempt and try to find some logic. Let us see where you go wrong.
0
Mark G. Ghrayeb Kindly note the format of the input, give every input on a new line.
Your name
1st friend
2nd friend
3rd friend
:
:
Enter "stop" to terminate
https://code.sololearn.com/cjO4PKUgmTNf/?ref=app
0
Thank you very much i appreciate that, can you do this question by using while and do because im still in this course i didnt get everything yet but if you cant no problem i still appreciate your help thank you a lot much respect