can someone help me with this program ?
first name : Tom
Last name : Damerji
Mother's maiden name : White
Town i was born in : Beirut
Write a new method that determines your Star Wars name.
The method will have 4 parameters, your first name, last name, mothers maiden name, and the town you were born. (1 point)
The method will return one String object, your Star Wars name. (1 point)
Your Star Wars name is created as per the instructions in blue below: (2 point)
Your Star Wars First Name:
1. Take the first 3 letters of your last name.
2. Add to that, the first 2 letters of your first name.
Your Star Wars Last Name:
1. Take the first 2 letters of your mother's maiden name.
2. Add the first 3 letters of the name of the town in which you
were born.
In the main method:
Ask the user to enter their first name, last name, mothers maiden name, and town they were born. Store all this data as different Strings. (1 point)
Pass all this data to your method, and the method should generate and return the users Star Wars name. (1 point)
Get the return value of the method, and display it to the screen. (1 point)
Hint: See the SubstringDemo.java file in the Examples section for how to parse a String
//****Code************
import java.util.Scanner;
public class StarWarsName {
//method to determine star wars name
public static String getStarWarsName(String fname, String lname, String mmName, String tbIn)
{
//declare variabels
String starWarsName ="";
String starWarsFirstName;
String starWarsLastName;
//str wars first name
starWarsFirstName = lname.substring(0,3) + fname.substring(0,2).toLowerCase();
//star wars last name
starWarsLastName = mmName.substring(0,2)+ tbIn.substring(0, 3).toLowerCase();
//star wars name
starWarsName = starWarsFirstName+" "+ starWarsLastName;
return starWarsName;
}
public static void main(String [] args)
{
//read input
Scanner scanner = new Scanner(System.in);
System.out.print("First name : ");
String firstName = scanner.nextLine();
System.out.print("Last name : ");
String lastName = scanner.nextLine();
System.out.print("Mother's maiden name : ");
String mothersMadainName = scanner.nextLine();
System.out.print("Town i was born in : ");
String townBornIn = scanner.nextLine();
//call function to get star wars name
String starWarsName = getStarWarsName(firstName, lastName, mothersMadainName, townBornIn);
System.out.println("\n\nYour Star Wars name is: "+ starWarsName);
}
}
//************Output Screenshot****

//****Please do let me know if you have any doubts or want me to modify the code************
can someone help me with this program ? first name : Tom Last name : Damerji...
(C++) There is a rumor circulating on the Internet that George Lucas (the creator of the Star Wars movies) uses a formula to create the names for the characters in his stories (Jar Jar Binks, ObiWan Kenobi, etc.) The formula allegedly-is the following: Star Wars first name: • Take the first three letters of your last name. • Add to that the first two letters of your first name. Star Wars last name: • Take the first two letters of...
Can someone verify the programming code below for visual studio code python. Stores your first name as a variable. Use all lowercase letters when you declare it. Stores your last name as a variable. Use all uppercase letters when you declare it. Prints out, "Hello, <first name> <last name>" with the first name converted to uppercase letters and the last name converted to lowercase letters using string functions. Prints out two newlines. Prints out the following: "Start by doing what's...
JAVA Can you make this return the first letter of first and last name capitalized? import java.io.File; import java.io.IOException; import java.util.*; public class M1 { public static void main(String[] args) { //scanner input from user Scanner scanner = new Scanner(System.in); // System.out.print("Please enter your full name: "); String fullname = scanner.nextLine(); //creating a for loop to call first and last name separately int i,k=0; String first="",last=""; for(i=0;i<fullname.length();i++) { char j=fullname.charAt(i); if(j==' ') { k=i; break; } first=first+j;...
Write a statement that creates a RegExp object that remembers the first and last name, but does not remember the title. Using the RegExp object's exec() method, assign the result variable with the remembered first and last name of the string userName. var userName = "Dr. Greg House"; // Code will also be tested with "Mr. Howard Wolowitz" /* Your solution goes here */ console.log(result[1] + " " + result[2]);
Hello! I'm posting this program that is partially completed if someone can help me out, I will give you a good rating! Thanks, // You are given a partially completed program that creates a list of employees, like employees' record. // Each record has this information: employee's name, supervisors's name, department of the employee, room number. // The struct 'employeeRecord' holds information of one employee. Department is enum type. // An array of structs called 'list' is made to hold...
Create a class called Student. This class will hold the first name, last name, and test grades for a student. Use separate files to create the class (.h and .cpp) Private Variables Two strings for the first and last name A float pointer to hold the starting address for an array of grades An integer for the number of grades Constructor This is to be a default constructor It takes as input the first and last name, and the number...
Create a class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create another class HourlyEmployee that inherits from the Employee class. HourEmployee must use the inherited parent class variables and add in HourlyRate and HoursWorked. Your HourEmployee class should contain a constructor that calls the constructor from the...
Document2 Tell me Layout References Mailings Review View 1. Write a program named Lab17B that will read 2 strings and compare them. a. Create a bool function named compareLetters that will accept 2 string variables as parameters and will return true if the strings have the same first letters and the same last letters. It will return a false otherwise. b. Create a bool function named inside that will accept the 2 string variables in the order they were entered)...
Complete the generateFormalName method so that… you return the formal name (Mr. or Ms. + last name) given a full name and gender (Strings) as parameters. --You can assume a valid name & gender (any case allowed) is passed in. Example 1: ("Bob Smith", "MaLE") passed in should generate "Mr. Smith" Example 2: ("Maggie May", "feMALE") passed in should generate "Ms. May" Tip 1: You are given a String formalName initialized to the empty String -- you will want to...
use Java and it must work for any name
String Manipulator Write a program to manipulate Strings. Store your full name into one String variable. It must include first name, middle name, last name, cach separated by spaces. Spaces could vary. If you do not have a middle name make up one For example the string to be processed could be any of the following John Plain Doe John Plain Doc John Plain Doe Your program must be able to...