3_ob85_meet
.docx
keyboard_arrow_up
School
Drexel University *
*We aren’t endorsed by this school
Course
540
Subject
Computer Science
Date
May 1, 2024
Type
docx
Pages
4
Uploaded by bbbtobi17
Tobi Bakare
04/19/2024
Week3Meet - 10 pts
Turn in on BBL as soon as complete, but before end of day Sunday following the lecture.
===============================
Reading a program
Read both programs. Be the computer and trace which line of code is executing in order. Keep track of what the current state of each variable is.
import java.util.Scanner;
/**********************************
* PuzzlePage.java
* Creates word puzzles for the Triangle
* @author Tammy Pirmann
* @version 20210407
*********************************/
public class PuzzlePage {
public static void main(String args[]){
Scanner keyboard = new Scanner(System.in);
WordScramble puzzle = new WordScramble();
System.out.print("Enter the solution word: ");
String solution = keyboard.nextLine();
System.out.printf("Your puzzle is: %s", puzzle.scramble(solution));
}
}
/*******************************
* WordScramble.java, Scrambles a given word
* @author Tammy Pirmann
* @version 20210407
*******************************/
public class WordScramble { private String solution;
//constructor
public WordScramble() {
solution = "NA";
}
//Setter
public void setSolution(String str){
solution = str.toUpperCase();
}
//Scrambles the solution String
public String scramble(String str){
setSolution(str);
String mix;
int a = solution.indexOf("A");
if (a >= 0) {
mix = solution.substring(a).concat(solution.substring(0,a));
}
int e = solution.indexOf("E");
if (e >= 0) {
mix = solution.substring(e).concat(solution.substring(0,e));
}
int i = solution.indexOf("I");
if (i >= 0) {
mix = solution.substring(i).concat(solution.substring(0,i));
}
int oh = solution.indexOf("O");
if (oh >= 0) {
mix = solution.substring(oh).concat(solution.substring(0,oh));
}
int u = solution.indexOf("U");
if (u >= 0) {
mix = solution.substring(u).concat(solution.substring(0,u));
}
//reverse it in case it still looks like the original word
return reverse(mix); }
//helper method to reverse the scrambled string
private String reverse(String str){
//base case
if (str.isEmpty()){
return str;
}
//Recursive call
return reverseString(str.substring(1)) + str.charAt(0);
}
}
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Need help please!
arrow_forward
OS ASSEMBLY CODE
Using YASM assembly code(x86)
.Create a program that accepts two user input. For any input from the two users, return True or false
Example:
Is today Friday ?
UserA: True
UserB: False
UserA is Wrong
UserB is Correct
arrow_forward
X = 56
arrow_forward
read the question and answer it correctly
arrow_forward
Task 'A' run on a CPU. The task starts by running for 6 ms. 'A' waits for 4 ms while the operating system runs some instructions to access memory. The CPU is then idle for 1 ms while waiting for the memory read to complete. Finally, the task 'A' runs another 25 ms and completes. What is the CPU performance in ms? [ Give answer as a number only]
arrow_forward
SEE ATTACHED PHOTO FOR THE INSTRUCTIONS AND QUESTIONS NEED TO BE ANSWERED
arrow_forward
Real-time Scheduling: Select all of the following statements that are true.
Rate Monotonic (RM) scheduling works by dividing the total amount of time
available up into an equal number of shares, and then each process must request
a certain share of the total when it tries to start.
A real-time system is schedulable under RM when its overall CPU utilization is
less than 1.
A real-time system is schedulable under Earliest Deadline First (EDF) when its
overall CPU utilization is less than or equal to 1.
If a process has period p, it is activated every p units of time.
RM scheduling assigns a higher priority to processes with shorter periods.
EDF scheduling assigns the highest priority to a process with the smallest
remaining time until its deadline.
arrow_forward
Computer Science
Code needs to be in C language. I am having trouble setting up my process with a year month day and time format. and I don't really understand what the CPU usage of a process is. any help would be appreciated.
arrow_forward
| ZV1O
= السؤال
The memory that directly communicate
with CPU is called auxiliary mamory.
true
false
حفظ الاجابة
arrow_forward
201.
Program execution services use to
a.
Control Program
b.
Delete Program
c.
Execute Program
d.
Update Programs
arrow_forward
Question
• Computer Engineering lab
You are assigned three tasks for this weekend, first
you have to develop a script in F95 programming
language to print the statement "Hikaru Nakamura
is a top chess player" 10 times to the output
window.
arrow_forward
Alert: Don't submit AI generated answer and give answer with proper explanation and step by step solution. (introduction,explanation,final answer).
arrow_forward
Here are some registers and storage locations during the run of a program.For this example, all numbers are hex.eax contains 300ebx contains 3000The doubleword at memory location 300 contains 500The doubleword at memory location 10 contains 70
What is in eax after the command addl $10, %eax executes?
a. 310
b. 510
c. 370
arrow_forward
The computer memory module speed is specified in catalogs or literature either by the speed in MHz (for example DDR4-xxxx) or in MB/s (for example PC4-xxxx) or both.
For example, if the memory speed is DDR4-4700, then the corresponding speed in MB/s is PC4-______
arrow_forward
Write assembly language program.
arrow_forward
Determine the output of the following Pep/9 machine-language program when the input typed into the Pep/9 input window is 35
Remember: the left column only shows the memory address of the first byte on the line. Do not copy these memory addresses into the Pep/9 object code
window
0000 D1FC15
0003 F10013
0006 D1FC15
0009 F1FC16
000C D10013
000F F1FC16
0012 00
arrow_forward
We can use the following cmdlet to display a list of running processes.
Group of answer choices
Get-Process
Display-Process
Get-RunningProcess
Get-Task
arrow_forward
write true or false for each of the following statements:
arrow_forward
The Population Studies Institute monitors the population of the United States. In 2008, this institute wrote a program to create files of the numbers representing populations of the various states, as well as the total population of the United States. This program, which runs on a Motorola processor, projects the population based on various rules, such as the average numbers of births and deaths per year. The institute runs the program and then ships the output files to state agencies so the data values can be used as input into various applications. However, one Pennsylvania agency, running all Intel machines, encountered difficulties, as indicated by the following problem. When the 32-bit unsigned integer 1D2F37E8 (representing the overall U.S. population prediction for 2013) is used as input, and the agency’s program simply outputs this input value, the U.S. population forecast for 2014 is far too large. Can you help this Pennsylvania agency by explaining what might be going wrong?…
arrow_forward
47.
Before proceeding with its execution, each process must acquire all the resources it needs is called
a.
hold and wait
b.
No pre-emption
c.
circular wait
d.
starvation
arrow_forward
Assume the following transection T1 and T2 executing in serial schedule. The Initial value of A=20 and B=10.
Find the result of serial schedule T1 followed by T2, A=………….., B=………..
Find the result of serial schedule T2 followed by T1, A=………….., B=………..
arrow_forward
How would you structure your code if you were creating it for a real-time operating system? What kind of restrictions on the system are you looking to impose? Think about the kinds of situations that might lead to unexpectedly long response times in the future. In certain cases, memory access may be slowed down in some way.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- read the question and answer it correctlyarrow_forwardTask 'A' run on a CPU. The task starts by running for 6 ms. 'A' waits for 4 ms while the operating system runs some instructions to access memory. The CPU is then idle for 1 ms while waiting for the memory read to complete. Finally, the task 'A' runs another 25 ms and completes. What is the CPU performance in ms? [ Give answer as a number only]arrow_forwardSEE ATTACHED PHOTO FOR THE INSTRUCTIONS AND QUESTIONS NEED TO BE ANSWEREDarrow_forward
- Real-time Scheduling: Select all of the following statements that are true. Rate Monotonic (RM) scheduling works by dividing the total amount of time available up into an equal number of shares, and then each process must request a certain share of the total when it tries to start. A real-time system is schedulable under RM when its overall CPU utilization is less than 1. A real-time system is schedulable under Earliest Deadline First (EDF) when its overall CPU utilization is less than or equal to 1. If a process has period p, it is activated every p units of time. RM scheduling assigns a higher priority to processes with shorter periods. EDF scheduling assigns the highest priority to a process with the smallest remaining time until its deadline.arrow_forwardComputer Science Code needs to be in C language. I am having trouble setting up my process with a year month day and time format. and I don't really understand what the CPU usage of a process is. any help would be appreciated.arrow_forward| ZV1O = السؤال The memory that directly communicate with CPU is called auxiliary mamory. true false حفظ الاجابةarrow_forward
- 201. Program execution services use to a. Control Program b. Delete Program c. Execute Program d. Update Programsarrow_forwardQuestion • Computer Engineering lab You are assigned three tasks for this weekend, first you have to develop a script in F95 programming language to print the statement "Hikaru Nakamura is a top chess player" 10 times to the output window.arrow_forwardAlert: Don't submit AI generated answer and give answer with proper explanation and step by step solution. (introduction,explanation,final answer).arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT