In: Computer Science
Please show all work:
Multiplying the binary number below by decimal 128 yields ________
1 0 0 1 1 0 0 1 0 . 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1
In: Computer Science
Write a Java programs.
Q.1. A freshman has 0-29 credits, a sophamore has 30-59, a junior has 60-89 and a senior has 90+ credits. Write a program to open the file and read all the contents. Report back to the user the number of freshmen, sophomores, juniors and seniors. Output the first and last names of the person with the highest GPA for each of those categories.
Q.2. (Occurrence of each letter) Write a Program that prompts the user to enter a file name and displays the occurrence of each letter in the file. Letters are case insensitive.
Students.java
The file students.txt has the following format on each line
fname(string) lname(string) credits(int) GPA(float) with a single space between each field.
For example
Mitchell Beck 11 2.88
Thelma Colon 43 2.25
Erma Mullins 68 1.98
Pedro Mack 17 1.95
.
In: Computer Science
Create a class called Cipher. Make the constructor accept some text and a key. Encrypt the given text using the key.
Use the following cipher:
Check the test cases for example.
Make getters to support the CipherDemo. Also, make two custom Exceptions called UselessKeyException and EmptyPlainText. In your constructor, throw UselessKeyException if the key is divisible by 26 and throw EmplyPainText if the plain text is zero characters.
CipherDemo.java :
import java.util.Scanner; public class CipherDemo { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter some text to encrypt"); String input = keyboard.nextLine(); System.out.println("Enter a key"); int key = keyboard.nextInt(); try { Cipher c = new Cipher(input, key); System.out.println("Plain text: " + c.getPlainText()); System.out.println("Cipher text: " + c.getCipherText()); System.out.println("Key: " + c.getKey()); } catch (EmptyPlainText e) { System.out.println(e.getMessage()); } catch (UselessKeyException e) { System.out.println(e.getMessage()); System.out.println("Useless key: " + e.getUselessKey()); } } }
input
abcENTER 1ENTER
output:
Enter some text to encrypt\n Enter a key\n Plain text: abc\n Cipher text: bcd\n Key: 1\n
input:
Hello, my secret password is SIMCITY! Don't tell anyone! I've used this for 400 days.ENTER 23
output:
Enter some text to encrypt\n Enter a key\n Plain text: Hello, my secret password is SIMCITY! Don't tell anyone! I've used this for 400 days.\n Cipher text: EbiilC7jv7pbzobq7mxpptloa7fp7PFJZFQV87Alk>q7qbii7xkvlkb87F>sb7rpba7qefp7clo7KGG7axvpE\n Key: 23\n
input:
With computer science, you can work in any industry.ENTER 5021ENTER
output:
Enter some text to encrypt\n Enter a key\n Plain text: With computer science, you can work in any industry.\n Cipher text: Zlwk#frpsxwhu#vflhqfh/#brx#fdq#zrun#lq#dqb#lqgxvwub1\n Key: 5021\n
input:
With computer science, you can work in any industry.ENTER 26ENTER
output:
Enter some text to encrypt\n Enter a key\n Error: Key is divisible by 26. That's a bad key!\n Useless key: 26\n
input : 23
output:
Enter some text to encrypt\n Enter a key\n Error: Nothing to encrypt!\n
In: Computer Science
c++ class homework
Topics
If/Else If statement
Description
Write a program that determines a student’s final grade in the course. The course had three tests (100 points each) and four assignments (also 100 points each). All the test scores make up 70% of the grade and all the assignments 30% of the grade.
The program asks the user to input one by one each of the test scores and each of the assignment scores. From these scores, it computes the percentage of total points obtained by the user. It then determines the user’s final grade according to the table below.
90%-100% A
80%-89.99% B
70%-79.99% C
60%-69.99% D
0%-59.99% F
At the end, the program displays a summary report including: the original tests scores, the original assignment scores, the overall percentage points earned by the user and the final grade.
Requirements
Do the assignment using if/else if statement (not multiple if statements)
Test Data
Use the test data in test run 1 and test run 2 below
(input values are in bold)
(It's OK if your output does not show decimal values in exactly the same way.)
Input Test Run 1
Enter Scores Test 1: 90
Enter Scores Test 2: 90
Enter Scores Test 3: 90
Enter Scores Assignment 1: 90
Enter Scores Assignment 2: 90
Enter Scores Assignment 3: 90
Enter Scores Assignment 4: 90
Output Test Run 1
Summary Report
Test Scores: 90.0, 90.0, 90.0
Assignment Scores: 90.0, 90.0, 90.0, 90.0
Overall Percentage: 90.0%
Final Grade: A
Input Test Run 2
Enter Scores Test 1: 70
Enter Scores Test 2: 72
Enter Scores Test 3: 68
Enter Scores Assignment 1: 66
Enter Scores Assignment 2: 68
Enter Scores Assignment 3: 72
Enter Scores Assignment 4: 74
Output Test Run 2
Summary Report
Test Scores: 70.0, 72.0, 68.0
Assignment Scores: 66.0, 68.0, 72.0, 74.0
Overall Percentage: 70.0%
Final Grade: C
Submit
Copy the following in a file and submit that file.
Final output of test runs.
All the C/C++ source code.
Sample Code
/*
Declare variables t1, t2 and t3 for storing test scores and a1, a2, a3 and a4 for storing assignment scores. The variable pct is used for storing overall percentage. The variable grade is used for scoring the final letter grade
*/
double t1, t2, t3, a1, a2, a3, a4, pct;
string grade;
//write code below to input one by one the test and assignment scores in the above variables
//compute the overall percentage scores
pct = ( ( (t1 + t2 + t3 ) / 3.0 ) * .70 ) + ( ( ( a1 + a2 + a3 + a4 ) / 4.0 ) * .30 );
//compute final grade on the basis of pct scores using if/else if statement
if (pct >= 90) {
grade = "A";
}
else if (pct >= 80) {
grade = "B";
}
else if (pct >= 70) {
grade = "C";
}
//complete the above if/else if statement
In: Computer Science
Create an ASP.Net Website using Visual Studio with Visual Basic.Net:
Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results
Create 4 buttons to add, subtract, multiply, and divide
Prevent the user from entering text in the number fields
Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box
Create two additional buttons:
- One to store data - The store data will store the results into array
- One to display data - The display data will display the contents of the array (use 10 for the array size)
In: Computer Science
Develop a Python program to identify the body-mass index of a collection of six individuals. Your program should include a list of six names. Note: If you chose to prompt for the names, build the list of names first, then do the following prompt for height, weight. Using a for loop, it should successively prompt the user for the height in inches and weight in pounds of each individual. Each prompt should display the name of the individual whose height and weight is to be input. Your program should validate that input for height and weight are positive. It should call a Function that accepts the height and weight as parameters and returns the body mass index for that individual using the formula: BMindex = weight × 703 / height2. (eg. 200lb, 6ft(72in) would be: BMindex = (200*703)/(72*72) = 27.1219 ). That body mass index should then be appended to a 2nd "parallel" array. Using a second loop it should traverse the array of body mass indices and call another function that accepts the body mass index as a parameter and returns whether the individual is underweight, normal weight or overweight. The number of individuals in each category should be counted and the number in each of those categories should be displayed. You should decide on the names of the at least six individuals and the thresholds used for categorization. Note: two loops and at least two functions. Display your name,class,date as per SubmissionRequirements by using a function.
In: Computer Science
4. What is ICMP and why is it important in data transferring? Give two examples of its usage. Also, explain why ICMP messages cannot be considered reliable.
In: Computer Science
- explain how the pseudo one-time pad works? What are its limitations?
In: Computer Science
I need a unique answer, NO COPY PLEASE!
Let us suppose we have 9 devices in a network. Explain what happens when a connection fails in the network arranged in the form of a:
In: Computer Science
Please show all work:
Represent the number (+46.5) as a 32 bit floating-point number using the IEEE standard 754 format. N.B. The attached ‘Appendix’ section may prove useful in the conversion process.
In: Computer Science
java
euclidean algorithm
(1) Let a = 35, and b = -49. Please compute GCD(a, b).
(2) Let a = 52, and b = 3. Please compute the quotient and remainder of a/b.
(3) Let a = -94, and b = 7. Please compute the quotient and remainder of a/b.
(4) Let a = 123, and b = 22. Please compute a mod b.
(5) Let a = -204, and b = 17. Please compute a mod b.
In: Computer Science
Please show all work:
Determine the 2’s complement equivalent of the following numbers in 8-bit format (N.B: You must show your work for full credit)!
In: Computer Science
c++ class
Topics
Branches
if statement
if/else statement
Description
Write a program that will determine whether the user passed or failed a test. The program will ask the user to input the following:
Maximum Test Score - the maximum total scores in the test.
Percent Pass Score - the minimum percent scores required to pass the test.
User Test Score - the actual scores obtained by the user in the test.
From the above input values, the program will compute the user percent score. It will compare the percent user score with the percent pass score. If the percent user score is equal to or greater than the percent pass score, the program will consider the user having passed the test. Otherwise, the program will consider the user having failed the test. At the end, the program will display the result summary. See the Test section below.
Testing
Perform the test run 1 and the test run 2 below with the data shown below.
(User input is shown in bold.)
(It's OK if your decimal values don't look the same as below so long as they are equal)
Test Run 1
Enter Maximum Test Score:
400
Enter Percent Pass Score:
80
Enter User Test Score:
324
Result Summary
Test Result: Pass
User Test Score: 324
User Percent Score: 81.0 %
Maximum Score: 400
Percent Pass Score: 80.0 %
Test Run 2
Enter Maximum Test Score:
400
Enter Percent Pass Score:
80
Enter User Test Score:
316
Result Summary
Test Result: Fail
User Test Score: 316
User Percent Score: 79.0 %
Maximum Score: 400
Percent Pass Score: 80.0 %
Submit
Copy the following in a file and submit that file.
Output of test runs.
All the C/C++ source code.
Sample Code
// declare variables
double maxScore, pctPassScore, userScore, pctUserScore;
//write code to input maxScore, pctPassScore, userScore
//determine pctUserScore
pctUserScore = (userScore / maxScore) * 100.0
//determine test result
cout << "Result Summary" << endl << endl;
if (pctUserScore >= pctPassScore) {
cout << "Test Result: Pass" << endl;
}
else {
cout << "Test Result: Fail" << endl;
}
In: Computer Science
please answer each next to its question
Problem Description:
(The Account class) Design a class named Account that
contains:
A private int data field named id for the account (default
0).
A private double data field named balance for the account (default
0).
A private double data field named annualInterestRate that stores
the current interest rate (default 0). Assume all accounts have the
same interest rate.
A private Date data field named dateCreated that stores the date
when the account was created.
A no-arg constructor that creates a default account.
A constructor that creates an account with the specified id and
initial balance.
The accessor and mutator methods for id, balance, and
annualInterestRate.
The accessor method for dateCreated.
A method named getMonthlyInterestRate() that returns the monthly
interest rate.
A method named withdraw that withdraws a specified amount from the
account.
A method named deposit that deposits a specified amount to the
account.
Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created.
Analysis:
(Describe the problem including input and output in your own
words.)
Design:
(Draw an UML class diagram for the Account class.)
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
public class Test {
public static void main (String[] args) {
Account account = new Account(1122, 20000);
Account.setAnnualInterestRate(4.5);
account.withdraw(2500);
account.deposit(3000);
System.out.println("Balance is " + account.getBalance());
System.out.println("Monthly interest is " +
account.getMonthlyInterest());
System.out.println("This account was created at " +
account.getDateCreated());
}
}
Class Account {
// Implement the class here
}
Testing: (Describe how you test this program)
In: Computer Science