Part1 code
import java.text.DecimalFormat;
import java.util.Scanner;
public class TransferAdvisor
{
private static DecimalFormat df2 = new DecimalFormat("0.##");
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
String collageName,major;
double gpa;
System.out.print("Enter the school name: ");
collageName=sc.next();
System.out.print("Enter the smajor: ");
major=sc.next();
System.out.print("Enter your GPA: ");
gpa=sc.nextDouble();
switch(collageName.toUpperCase())
{
case "UCLA":
checkTransger(collageName,major,gpa);
break;
case "UCB":
checkTransger(collageName,major,gpa);
break;
case "UCI":
checkTransger(collageName,major,gpa);
break;
case "UCSD":
checkTransger(collageName,major,gpa);
break;
default:
System.out.println(collageName+" is not in the school system.");
}
}
private static void checkTransger(String collageName, String major, double gpa)
{
switch(major.toUpperCase())
{
case "CS":
switch(collageName.toUpperCase())
{
case "UCLA":
if(gpa>=3.7)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.7-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCB":
if(gpa>=3.8)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.8-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCI":
if(gpa>=3.6)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.6-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCSD":
if(gpa>=3.5)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.5-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
}
break;
case "ECON":
switch(collageName.toUpperCase())
{
case "UCLA":
if(gpa>=3.5)
System.out.println("You can transger to "+collageName+" to study "+major);
else
System.out.println("You need to improve your GPA by "+df2.format(3.5-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCB":
if(gpa>=3.4)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.4-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCI":
if(gpa>=3.7)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.7-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCSD":
if(gpa>=3.3)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.3-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
}
break;
case "ENGLISH":
switch(collageName.toUpperCase())
{
case "UCLA":
if(gpa>=3.2)
System.out.println("You can transger to "+collageName+" to study "+major);
else
System.out.println("You need to improve your GPA by "+df2.format(3.2-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCB":
if(gpa>=3.3)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.3-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCI":
if(gpa>=3.4)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.4-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
case "UCSD":
if(gpa>=3.0)
System.out.println("You can transger to "+collageName+" to study CS.");
else
System.out.println("You need to improve your GPA by "+df2.format(3.0-gpa)+" to transfer to "+ collageName +" to study "+major);
break;
}
break;
default:
System.out.println("There is no major "+major+" at "+collageName);
}
}
}
output



part 2
import java.util.Scanner;
public class SecretMessage
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
String plainMsg,encodedMsg;
int choice;
char c;
do
{
System.out.print("Enter 1 to encode,2 to decode, 3 to quit: ");
choice=sc.nextInt();
switch(choice)
{
case 1:
System.out.println("Enter a text to encode: ");
plainMsg=sc.nextLine();
encodedMsg="";
for(int i=0;i<plainMsg.length();i++)
{
c=plainMsg.charAt(i);
if(Character.isLetter(c))
{
encodedMsg+=codeChar(c,true);
}
else
encodedMsg+=c;
}
System.out.println(encodedMsg);
break;
case 2:
System.out.println("Enter a text to decode: ");
encodedMsg=sc.nextLine();
plainMsg="";
for(int i=0;i<plainMsg.length();i++)
{
c=encodedMsg.charAt(i);
if(Character.isLetter(c))
{
plainMsg+=codeChar(c,false);
}
else
plainMsg+=c;
}
System.out.println(plainMsg);
break;
case 3:
break;
default:
System.out.println("Invalid choice!!!");
}
}while(choice!=3);
}
public static char codeChar(char c,boolean flag)
{
String letters="abcdefghijklmnopqrstuvwxyz";
String enc="kngcadsxbvfhjtiumylzqropwe";
char ch='a';
if(flag)
{
if(isLowerCaseLetter(c))
{
ch=enc.charAt(letters.indexOf(c));
}
else
{
c=toLowerCase(c);
ch=enc.charAt(letters.indexOf(c));
ch=Character.toUpperCase(ch);
}
}
else
{
if(isLowerCaseLetter(c))
{
ch=letters.charAt(enc.indexOf(c));
}
else
{
c=toLowerCase(c);
ch=letters.charAt(enc.indexOf(c));
ch=Character.toUpperCase(ch);
}
}
return ch;
}
private static boolean isLowerCaseLetter(char c) {
return Character.isLowerCase(c);
}
private static char toLowerCase(char c) {
return Character.toLowerCase(c);
}
}
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
cs55(java) please Part 1: You are a programming intern at the student transfer counselor's office. Having...
In C++ Having heard you have gotten really good at programming, your friend has come to ask for your help with a simple task. She would like you to implement a program to encrypt the messages she exchanges with her friends. The idea is very simple. Every letter of the alphabet will be substituted with some other letter according to a given key pattern like the one below. "abcdefghijklmnopqrstuvwxyz" "doxrhvauspntbcmqlfgwijezky" // key pattern For example, every 'a' will become a...
WE ARE USING PYTHON TO COMPLETE THIS ASSIGNMENT :) THANK YOU! In this programming assignment, you will write functions to encrypt and decrypt messages using simple substitution ciphers. Your solution MUST include: a function called encode that takes two parameters: key, a 26-character long string that identifies the ciphertext mapping for each letter of the alphabet, in order; plaintext, a string of unspecified length that represents the message to be encoded. encode will return a string representing the ciphertext. a...
Do this using the C language. show me the code being executed
and also copy and paste the code so i can try it out for
myseld
Instructions A cipher is mirrored algorithm that allow phrases or messages to be obfuscated (ie. "scrambled"). Ciphers were an early form of security used to send hidden messages from one party to another. The most famous and classic example of a cipher is the Caesar Cipher. This cypher worked by shifting each letter...
Cipher Program Specifications: You are to write a program called, "Cipher123" that reads in an encoded message using the 1-2-3 cipher and returns the decoded message. The program should continue prompting for additional encoded messages until the user chooses to quit the program. When decoding a message, we take the first letter of the first word, the second letter of the second word and the third letter of the third word and concatenate them. We repeat this same process 1-2-3...
In this laboratory we are going to do part of the Homework 2 assignment. We will be creating the program which takes a file containing the message in morse code and converts it to the alphabetic message. Your program should include the following functions : class Code { public: Code(); // Default constructor - loads and uses morse code string decode(vector< string> message); // decodes a message private: vector<string> codewords; // this is a codeword vector parallel to A-Z vector<char>...
Q16-Decoder (0.5 points) Write a code block to decode strings from secret encodings back to readable messages. To do so: Initialize a variable called decoded as an empty string . Use a for loop to loop across all characters of a presumed string variable called encoded Inside the loop, convert the character to another character o Get the unicode code point for the character (using ord o Subtract the value of key to that code point (which should be an...
Write a static method called encodeString that takes a string as input and prints to the console a word where each letter is advanced by one value. In addition, your method should return the encoded String. You may make use of the method provided below to help you. public static char encode(char x) { int current = x; current++; return (char)current; } This method takes a character and returns an "encoded" character. In other words, encode('a') will return 'b'. Your...
Cryptography, the study of secret writing, has been around for a very long time, from simplistic techniques to sophisticated mathematical techniques. No matter what the form however, there are some underlying things that must be done – encrypt the message and decrypt the encoded message. One of the earliest and simplest methods ever used to encrypt and decrypt messages is called the Caesar cipher method, used by Julius Caesar during the Gallic war. According to this method, letters of the...
Can someone please help me for this assignment? Cryptography — the science of secret writing — is an old science; the first recorded use was well before 1900 B.C. An Egyptian writer used previously unknown hieroglyphs in an inscription. We will use a simple substitution cypher called rot13 to encode and decode our secret messages. ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in...
MUST WRITE IN C++ Objective: Learn how to design classes using abstract classes and inheritance Assignment: In cryptography, encryption is the process of encoding a message or information in such a way that only authorized parties can access it. In this lab you will write a program to decode a message that has been encrypted using two different encryption algorithms. Detailed specifications: Define an abstract class that will be the base class for other two classes. It should have: A...