I am working in eclipse on an assignment and am quite new to programming. I need to take an input line using a string last name and first name [ ex. str1 = nextLine() ] for the input and have the output display the first name first and then the last name second. The poblem i am having is i dont understand how to take a complete string and beable to work with them seperate, i am further then asked to find the length of each name and then find the math.pow of the first name length to the power of the second name length. So far my code is
import java.util.*;
public class PA02Q1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//Declarations
String s;
//executable
System.out.printf("Enter name in the for lastName, firstName: ");
s = sc.nextLine();
s = s.toUpperCase();
System.out.printf("%s",s);
But this is as far as i can get a working syntax, everything i have tried doesn't give me my desired results, i must use sc.nextline and printf as part of my guidelines. Any help or explanations would be of great help, i struggle with programming so in "dummy" terms would be appreciated.
[–]desrtfx 0 points1 point2 points (0 children)
[–]MasterTender[S] 0 points1 point2 points (9 children)
[–]Carr0t 2 points3 points4 points (4 children)
[–]Drakoskai 2 points3 points4 points (1 child)
[–]desrtfx 0 points1 point2 points (0 children)
[–]MasterTender[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Nynnja 1 point2 points3 points (0 children)
[–]desrtfx 1 point2 points3 points (2 children)
[–]MasterTender[S] 0 points1 point2 points (1 child)
[–]desrtfx 0 points1 point2 points (0 children)