package ronn1;
public class Ronn1 {
private String Full_Name;
private String Exam_Name;
private String Exam_Score;
private String Exam_Grade;
Ronn1(){
Full_Name = "no name given";
Exam_Name = "Unknown";
Exam_Score = "No score";
Exam_Grade = "Unknown";
String fullname(String aName){
Full_Name = aName;
return Full_Name;
String examName (String examCode){
if(examCode.equals("VB")) {
Exam_Name = "Visual Basics . NET";
}else if (examCode.equals("JV")) {
Exam_Name = "Java";
}else if (examCode.equals("C#")) {
Exam_Name = "C#. NET";
}else if (examCode.equals("PH")) {
Exam_Name = "PHP";
}else {
Exam_Name = "No Exam Selected";
return Exam_Name;
String examScore(int aScore){
Exam_Score = aScore + " out of 50";
return Exam_Score;
private String getGrade (int aScore) {
String examGrade = "" ;
if (aScore >= 0 && aScore <= 10) {
examGrade = "E";
else if (aScore >= 11 && aScore <= 20) {
examGrade = "D";
else if (aScore >= 21 && aScore <= 30) {
examGrade = "C";
else if (aScore >= 31 && aScore <= 40) {
examGrade = "B";
}
else if (aScore >= 41){
examGrade = "A";
return "Grade is " + examGrade;
String examGrade(int aScore) {
Exam_Grade = this.getGrade( aScore) ;
return Exam_Grade;
package ronn1;
import java.util.Scanner;
public class Ronn2 {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
Ronn1 aStudent = new Ronn1();
String aName = aStudent.fullname("Bill Gates");
String examName = aStudent.examName("PH");
String score = aStudent.examScore(30);
String grade = aStudent.examGrade(30);
System.out.println(aName);
System.out.println(examName);
System.out.println(score);
System.out.println(grade);
Output:
Bill Gates
PHP
30 out of 50
Grade is C
@@@@@
package kevin1;
import java.util.Scanner;
public class Kevin2 {
public static void main(String[] args) {
Scanner nigga = new Scanner(System.in);
// Input Sentence
System.out.print("Enter a sentence: ");
String Sentence = nigga.nextLine();
// Change word
System.out.print("Which character/s would you like to change: ");
String Change = nigga.nextLine();
System.out.print( Change + " would change into: ");
String Changes = nigga.nextLine();
if (Change != Changes){
String NewSentence = Sentence.replace(Change,Changes);
System.out.println( "Old Sentence: " + Sentence);
System.out.print( "New Sentence: " + NewSentence);
else if (Change == Changes){
System.out.println( "No character/s found");
@@@@@
package ceasar.cipher;
import java.util.Scanner;
public class CeasarCipher {
public static void main(String[] args) {
Scanner cipher = new Scanner(System.in);
System.out.print("Enter a sentence: ");
String Sentence = cipher.nextLine();
System.out.print("Which character/s would you like to change: ");
String Change = cipher.nextLine();
System.out.print( Change + " would change into: ");
String Changes = cipher.nextLine();
if (Change != Changes){
String NewSentence = Sentence.replace(Change,Changes);
System.out.println( "Old Sentence: " + Sentence);
System.out.println( "New Sentence: " + NewSentence );
else if (Change == Changes){
System.out.println( "No character/s found");
}
//public static void main(String[] args) {
//Scanner nigga = new Scanner(System.in);
// Input Sentence
//System.out.print("Enter a sentence: ");
//String Sentence = nigga.nextLine();
// Change word
// System.out.print("Which character/s would you like to change: ");
// String Change = nigga.nextLine();
///System.out.print( Change + " would change into: ");
//String Changes = nigga.nextLine();
//if (Change != Changes){
//String NewSentence = Sentence.replace(Change,Changes);
//System.out.println( "Old Sentence: " + Sentence);
//System.out.print( "New Sentence: " + NewSentence);
//}
//else if (Change == Changes){
// System.out.println( "No character/s found");
//}
//}
//}
@@@@@
package project.pkg1;
import java.util.Scanner;
public class practice {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String gender = "Male";
System.out.println("MALE = M FEMALE = F");
String answers = input.nextLine();
if (answers.contentEquals("M")) {
System.out.println("zzz");
} else if (answers.contentEquals("F")) {
System.out.println("nigga");
} else {
System.out.println("Dafuq");
MALE = M FEMALE = F
You're Male
@@@@@
package practice3.pkg2;
public class Practice32 {
public static void main(String[] args) {
// The number of rows in the pattern
int rows = 5;
// Looping through each row
for (int I = 1; I <= rows; i++) {
// Printing spaces before the stars
for (int j = 1; j <= rows – I; j++) {
System.out.print(“ “);
// Printing stars in each row
for (int k = 1; k <= 2 * I – 1; k++) {
System.out.print(“1”);
// Moving to the next line
System.out.println();
Output:
1
111
11111
1111111
111111111
@@@@@
package ceasarcipher;
import java.util.Scanner;
public class CeasarCipher {
// define a constant string for the alphabet
public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz";
// create a method to encrypt a message with a given shift
public static String encrypt(String message, int shift) {
// convert the message to lower case
message = message.toLowerCase();
// create a string builder to store the encrypted message
StringBuilder encrypted = new StringBuilder();
// loop through each character of the message
for (char c : message.toCharArray()) {
// check if the character is a letter
if (Character.isLetter(c)) {
// find the index of the character in the alphabet
int index = ALPHABET.indexOf(c);
// add the shift to the index and wrap around if needed
int newIndex = (index + shift) % 26;
// get the new character from the alphabet
char newChar = ALPHABET.charAt(newIndex);
// append the new character to the encrypted message
encrypted.append(newChar);
} else {
// if the character is not a letter, just append it as it is
encrypted.append(c);
}
// return the encrypted message as a string
return encrypted.toString();
// create a method to decrypt a message with a given shift
public static String decrypt(String message, int shift) {
// convert the message to lower case
message = message.toLowerCase();
// create a string builder to store the decrypted message
StringBuilder decrypted = new StringBuilder();
// loop through each character of the message
for (char c : message.toCharArray()) {
// check if the character is a letter
if (Character.isLetter(c)) {
// find the index of the character in the alphabet
int index = ALPHABET.indexOf(c);
// subtract the shift from the index and wrap around if needed
int newIndex = (index - shift + 26) % 26;
// get the new character from the alphabet
char newChar = ALPHABET.charAt(newIndex);
// append the new character to the decrypted message
decrypted.append(newChar);
} else {
// if the character is not a letter, just append it as it is
decrypted.append(c);
// return the decrypted message as a string
return decrypted.toString();
// create a main method to test the program
public static void main(String[] args) {
// create a scanner object for user input
Scanner scan = new Scanner(System.in);
// ask the user to enter a message to encrypt
System.out.print("Enter a message to encrypt: ");
// read the message from the user
String message = scan.nextLine();
// ask the user to enter a shift value
System.out.print("Enter a shift value: ");
// read the shift value from the user
int shift = scan.nextInt();
// close the scanner object
scan.close();
// encrypt the message with the given shift
String encrypted = encrypt(message, shift);
// print the encrypted message
System.out.println("Encrypted message: " + encrypted);
// decrypt the message with the same shift
String decrypted = decrypt(encrypted, shift);
// print the decrypted message
System.out.println("Decrypted message: " + decrypted);
}
@@@@@
A Java reviewer is a tool that can help you improve the quality, security, and performance of your Java
code by detecting and fixing common errors, bugs, and vulnerabilities. There are many Java reviewers
available, but I can create one for you using my own words and knowledge.
Here is a sample Java reviewer that I generated for you. It is a simple program that takes a Java source
file as an input and prints out some feedback on the code quality, style, and security. It uses some basic
rules and metrics to evaluate the code, such as indentation, naming conventions, cyclomatic complexity,
and potential security risks. It is not a comprehensive or professional tool, but it can give you some
useful suggestions to improve your Java code.
To use this Java reviewer, you need to save it as a Java file (for example, JavaReviewer.java) and compile
it with the javac command. Then, you can run it with the java command and pass the name of the Java
source file that you want to review as an argument. For example, if you want to review a file named
HelloWorld.java, you can run:
Java
AI-generated code. Review and use carefully. More info on FAQ.
javac JavaReviewer.java
java JavaReviewer HelloWorld.java
Here is the code of the Java reviewer:
Java
AI-generated code. Review and use carefully. More info on FAQ.
import java.io.*;
import java.util.*;
// A simple Java reviewer that evaluates a Java source file and gives some feedback
public class JavaReviewer {
// A list of keywords in Java
private static final Set<String> keywords = new HashSet<>(Arrays.asList(
"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const",
"continue", "default", "do", "double", "else", "enum", "extends", "final", "finally", "float",
"for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native",
"new", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super",
"switch", "synchronized", "this", "throw", "throws", "transient", "try", "void", "volatile", "while"
));
// A list of operators in Java
private static final Set<String> operators = new HashSet<>(Arrays.asList(
"+", "-", "*", "/", "%", "++", "--", "=", "+=", "-=", "*=", "/=", "%=", "&=", "^=", "|=", "<<", ">>", ">>>",
"<<=", ">>=", ">>>=", "==", "!=", ">", "<", ">=", "<=", "&&", "||", "!", "&", "|", "^", "~", "?", ":"
));
// A list of separators in Java
private static final Set<String> separators = new HashSet<>(Arrays.asList(
"(", ")", "{", "}", "[", "]", ";", ",", "."
));
// A list of common security risks in Java
private static final Set<String> risks = new HashSet<>(Arrays.asList(
"Runtime.exec", "ProcessBuilder", "System.load", "System.loadLibrary", "Class.forName",
"ClassLoader",
"Compiler", "InetAddress", "URL", "URLConnection", "HttpURLConnection", "Socket",
"ServerSocket", "SSLContext",
"SSLSocket", "SSLServerSocket", "Cipher", "KeyGenerator", "KeyPairGenerator", "KeyStore", "Mac",
"MessageDigest",
"Signature", "Certificate", "CertPath", "CertStore", "Policy", "Permissions", "PermissionCollection",
"Permission",
"AllPermission", "SecurityManager", "AccessController", "Serializable", "ObjectInputStream",
"ObjectOutputStream",
"Externalizable", "readObject", "writeObject", "readResolve", "writeReplace", "readExternal",
"writeExternal",
"clone", "finalize", "Thread", "ThreadGroup", "Runnable", "Callable", "Executor", "ExecutorService",
"ScheduledExecutorService",
"ScriptEngine", "ScriptEngineManager", "Compilable", "Invocable", "File", "RandomAccessFile",
"FileDescriptor", "FileInputStream",
"FileOutputStream", "FileReader", "FileWriter", "FilenameFilter", "FileFilter", "FileSystem", "Path",
"Paths", "Files", "DirectoryStream",
"WatchService", "WatchKey", "WatchEvent", "UserPrincipal", "UserPrincipalLookupService",
"FileAttribute", "FileAttributeView",
"FileStore", "FileStoreAttributeView", "FileVisitor", "FileTreeWalker", "SecureDirectoryStream",
"LinkPermission", "Scanner",
"Formatter", "PrintStream", "PrintWriter", "Console", "Clipboard", "Transferable", "DataFlavor",
"SystemFlavorMap", "Robot",
"AWTPermission", "KeyboardFocusManager", "DefaultKeyboardFocusManager",
"KeyEventDispatcher", "KeyEventPostProcessor", "AWTKeyStroke",
"MouseInfo", "PointerInfo", "Toolkit", "GraphicsEnvironment", "GraphicsDevice",
"GraphicsConfiguration", "BufferCapabilities",
"ImageCapabilities", "Graphics", "Graphics2D", "BufferedImage", "VolatileImage",
"RenderedImage", "WritableRenderedImage", "Image",
"ImageObserver", "ImageProducer", "ImageConsumer", "ImageFilter", "BufferedImageFilter",
"RGBImageFilter", "CropImageFilter",
"ReplicateScaleFilter
A Java reviewer is a tool that can help you improve the quality, security, and performance of your Java
code by detecting and fixing common errors, bugs, and vulnerabilities. There are many Java code review
tools available, but I can create a simple one for you using my own words and knowledge.
Here is a basic Java reviewer that checks for some common coding issues:
Java
AI-generated code. Review and use carefully. More info on FAQ.
// A simple Java reviewer that checks for some common coding issues
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class JavaReviewer {
// A method that reads a Java file and prints out the issues found
public static void review(String fileName) {
try {
// Create a scanner to read the file
Scanner scanner = new Scanner(new File(fileName));
// Keep track of the line number
int lineNumber = 1;
// Loop through each line of the file
while (scanner.hasNextLine()) {
// Get the current line
String line = scanner.nextLine();
// Check for empty lines
if (line.isEmpty()) {
System.out.println("Empty line at line " + lineNumber);
// Check for trailing spaces
if (line.endsWith(" ")) {
System.out.println("Trailing space at line " + lineNumber);
// Check for hard-coded values
if (line.contains("\"") || line.contains("\'")) {
System.out.println("Hard-coded value at line " + lineNumber);
// Check for unused imports
if (line.startsWith("import")) {
String importName = line.substring(7, line.length() - 1);
if (!fileContains(fileName, importName)) {
System.out.println("Unused import at line " + lineNumber);
}
// Increment the line number
lineNumber++;
// Close the scanner
scanner.close();
} catch (FileNotFoundException e) {
// Handle the exception
System.out.println("File not found: " + fileName);
// A helper method