الله يسعدكم ساعدوني هذا واجب وحده صحباتي طلبته مني وهي ماهي عارفة تحله يابنات جامعة عزوز قسم حاسب ساعدوها(وعاد هو جافا )
وهذا السؤال .........
Write a program that prompts the user to input his full name and then generates a secure and unrepeatable new account user name for any system that consists of three parts separated by an underscore:
-
The first part contains the first letters of each part of the user full Name.
-
The second part contains the date of today with no spaces or symbols like "23032008".
-
The last part is generated through the following steps.
·
Generate a random integer number from 1 to 5
·
Generate a random float number from -5 to -0.000001
·
Raise the float number to the power of the integer number and then print it in a form of two digits only after the decimal point.
·
Using math methods, bring the absolute of the resulted value and round it to the nearest number less than or equal to it.
·
Using wrapper methods, convert the integer part of the rounded number to a hexadecimal number.
Finally, Concatenate all parts and print the whole Generated User Name.
وهذا حلي ....................................
import java.util*;
import java.text.*;
class labb3 {
public static void main (String
args){
String name,space,lastpar;
double power,floor;
Scanner scan = new Scanner (System.in);
System.out.println ("Please Enter your Full Name:");
first = name.substring(0, name.indexOf(space));
name = name.substring(name.indexOf(space)+1,name.length() );
middle = name.substring(0, name.indexOf(space));
last = name.substring(name.indexOf(space)+1,name.length() );
lastpart= first.substring(0, 1) +
middle.substring(0, 1) +
last.substring(0,1);
System.out.println("the first part" ""+lastpart);
Date today;
SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy");
today = new Date();
Random generator=new Random();
int num1,;
float num2,num3;
num1= generator.nextInt(5)+1;
System.out.println("arandom num 1to5"+num1)
num2=generator.nextFloat()*5;
num3=num2-5;
System.out.println("randum num "+num3)
power=Math.pow(num1,num3);
System.out.println("randum num "+power);
DecimalFormat fmt = new DecimalFormat("0.##");
System.out.println("form of tow digit"+fmt.format(power));
float value;
value=Math.abs(fmt);
System.out.println("absolut valu"+(value);
double num4:num4=Math .floor(value);
System.out.println("nearst num" +num4);
System.out.println(the first part "_" "_" nearst num)
}
}