How to separate 2000H of external RAM? Sent the high 4
bits to the low 4 bits of 2001H, and the low 4 bits are sent to the
low 4 bits of 2002H. Clear the high 4 bits of 2001H and
2002H.
the answer in C program please
In: Computer Science
Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a C++ program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the source code file named MovieGuide.cpp is open in your code editor. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop. The output statements within the loop have already been written for you. Ensure you include the calculations to compute the average rating. Execute the program by clicking the Run button. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Ensure the average output is correct.
this is the prewritten code:
// MovieGuide.cpp - This program allows each theater patron to enter a value from 0 to 4
// indicating the number of stars that the patron awards to the Guide's featured movie of the
// week. The program executes continuously until the theater manager enters a negative number to
// quit. At the end of the program, the average star rating for the movie is displayed.
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Declare and initialize variables.
double numStars; // star rating.
double averageStars; // average star rating.
double totalStars = 0; // total of star ratings.
int numPatrons = 0; // keep track of number of patrons
// This is the work done in the housekeeping() function
// Get input.
cout << "Enter rating for featured movie: ";
cin >> numStars;
// This is the work done in the detailLoop() function
// Write while loop here
// This is the work done in the endOfJob() function
cout << "Average Star Value: " << averageStars << endl;
return 0;
} // End of main()
In: Computer Science
Please, write this code in c++. Using iostream and cstring library.
Write a function that will delete all words in the given text that meets more that one time. Also note than WORD is sequence of letters sepereated by whitespace.
Note. The program have to use pointer.
Input: First line contains one line that is not longer than 1000 symbols with whitespaces. Each word is not longer than 30 symbols.
Output: Formatted text.
example:
input: Can you can the can with can ?
output: Can you can the with ?
In: Computer Science
Please, write code in c++. Using iostream and cstring library.
You given a text.Your task is to write a function that will find
the longest sequence of digits inside.
Note that the output have to be presened just like in sample.
Note. The program have to use pointer.
Input:
First line contains one line that is not longer than 1000.
Output:
The longest sequence of numbers.All numbers are positive and
integers.
example:
input: 101 fdvnjfkv njfkvn fjkvn jffdvfdvfd2010
output: 2010
In: Computer Science
review of related literature about development of fire response system
In: Computer Science
Please, write code in c++. Using iostream library.
Most modern text editors are able to give some statistics about
the text they are editing. One nice statistic is the average word
length in the text. A word is a maximal continuous sequence of
letters ('a'-'z', 'A'-'Z'). Words can be separated by spaces,
digits, and punctuation marks. The average word length is the sum
of all the words' lengths divided by the total number of
words.
For example, in the text "This is div2 easy problem". There are 5 words: "This"is"div"easy" and "problem". The sum of the word lengths is 4+2+3+4+7 = 20, so the average word length is 20/5 = 4.
Given a text, return the average word length in it. If there are no words in the text, return 0.0.
Input
The first line will contain the text of length between 0 and 50
characters inclusive. Text will contain only letters ('a'-'z',
'A'-'Z'), digits ('0'-'9'), spaces, and the following punctuation
marks: ',', '.', '?', '!', '-'. The end of text will be marked with
symbol '#' (see examples for clarification).
Output
Output should contain one number - the average length. The returned
value must be accurate to within a relative or absolute value of
10-9.
example:
input:
This is div2 easy problem.#
output:
4.0
In: Computer Science
package questions;
public class File {
public String base; //for example, "log" in
"log.txt"
public String extension; //for example, "txt" in
"log.txt"
public int size; //in bytes
public int permissions; //explanation in toString
//DO NOT MODIFY
public String getBase() {
return base;
}
/**
*
* @param b
* if b is null or if empty (""), base should become
"default",
* for all other values of b, base should become
b
*/
public void setBase(String b) {
//to be completed
}
//DO NOT MODIFY
public String getExtension() {
return extension;
}
/**
*
* @param e
* if e is null or if empty (""), extension should
become "txt",
* for all other values of e, extension should become
e
*/
public void setExtension(String e) {
//to be completed
}
//DO NOT MODIFY
public int getSize() {
return size;
}
/**
*
* @param s
* if s is less than 0, size should become 0
* if s is more than or equal to 0, size should become
s
*/
public void setSize(int s) {
//to be completed
}
//DO NOT MODIFY
public int getPermissions() {
return permissions;
}
/**
*
* @param p
* if p is less than 0, permissioons should become
0
* if p is more than 7, permissions should become
7
* if p is between 0 and 7 (inclusive on both sides),
permissions should become p
*/
public void setPermissions(int p) {
//to be completed
}
//DO NOT MODIFY
public File() {
setBase("default");
setExtension(".txt");
setSize(0);
setPermissions(0);
}
/**
*
* @param b: value for base
* @param e: value for extension
* @param s: value for size
* @param p: value for permissions
*/
public File(String b, String e, int s, int p) {
//to be completed
}
//DO NOT MODIFY
public String getName() {
return base + "." +
extension;
}
/**
*
* This method should set the size to 0, permission to
0, extension to null and base to null.
*
* Note that your File constructor and setters must be
correct to pass the JUnit tests.
*
*/
public void wipe() {
//to be completed
}
/**
*
* @param other
* @return
* 1 if calling object is bigger in size than the
parameter object
* -1 if calling object is smaller in size than the
parameter object
* 0 if calling object has the same size as the
parameter object
*/
public int compareTo(File other) {
return 0; //to be completed
}
/**
*
* @param other
* @return true if calling object and parameter object
are identical
* in every aspect (base, extension, size,
permissions)
*
* NOTE: file name should be checked in case
INsensitive manner
*
* HINT: Strings are NOT compared using == (s1 == s2 is
WRONG)
* Google "String comparison java" and "String case
insensitive comparison java" to
* see the right way!
*/
public boolean equals(File other) {
if(other instanceof File) {
return (new String("size1").equals(other.size)&&new String("base1").equalsIgnoreCase(other.base)&&new String("permission1").equals(other.permissions) && new String("extension1").equalsIgnoreCase(other.extension));
}
return false;
}
/**
* @return a new folder object with the same
permission, size, base and extension as the calling object.
* (In other words, return a deep copy of the calling
object.
*/
public File clone() {
return null; //to be
completed
}
/**
* HD
* return String representation of the calling
object.
*
* Size:
*
* 1024 bytes = 1 kilobyte (KB)
* 1024 kilobytes = 1 megabyte (MB)
* 1024 megabytes = 1 gigabyte (GB
*
* for files below 1024 bytes, you should represent
size in bytes (B)
* for files 1024 bytes or more but less than 1024
kilobytes, you should represent size in kilobytes (KB)
* for files 1024 kilobytes or more but less than 1024
megabytes, you should represent size in megabytes (MB)
* for files 1024 megabytes or more, you should
represent size in gigabytes (GB)
*
* only the integer part of size should be
displayed.
*
* Permissions:
*
* Permissions is a number between 0 and 7.
* 1st bit represents read permission,
* 2nd bit represents write permission,
* 3rd bit represents execute permissiono
*
* 0: 000 (---)
* 1: 001 (--x)
* 2: 010 (-w-)
* 3: 011 (-wx)
* 4: 100 (r--)
* 5: 101 (r-x)
* 6: 110 (rw-)
* 7: 111 (rwx)
*
*
https://www.tutorialspoint.com/unix/unix-file-permission.htm
*
* Syntax of toString:
* <permissions in (r/-)(w/-)(x/-) format>
<file name> <integer size in correct magnitude>
*
* Some examples:
* if base = "log", extension = "txt", size = 1056,
permissions = 4,
* the String returned should return
*
*
"r--
log.txt 1KB"
*
* if base = "data", extension = "csv", size = 4500000,
permissions = 7,
* the String returned should return:
*
*
"rwx
data.csv 4MB"
*/
public String toString() {
return ""; //to be completed
}
}
In: Computer Science
Please, write code in c++. Using iostream library
A chessboard pattern is a pattern that satisfies the
following conditions:
• The pattern has a rectangular shape.
• The pattern contains only the characters '.' (a dot) and 'X' (an
uppercase letter X).
• No two symbols that are horizontally or vertically adjacent are
the same.
• The symbol in the lower left corner of the pattern is '.' (a
dot).
You are given two numbers. N is a number of rows and
M is a number of columns. Write a program that generates
the chessboard pattern with these dimensions, and outputs
it.
Input
The first line contains two numbers N and M (1 ≤
N ≤ 50, 1 ≤ M ≤ 50) separated by a
whitespace.
Output
Output should contain N lines each containing M
symbols that correspond to the generated pattern. Specifically, the
first character of the last row of the output represents the lower
left corner (see example 1).
example:
input:
8 8
output:
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
In: Computer Science
Draw Data Flow Diagrams for the following system. Starting with a context diagram, draw as many nested DFDs as you consider necessary to represent all of the details of the system described in the following narrative. Context diagram, Level-0, and Level 1 diagrams are required. You may choose to decompose to level-2, level-3, etc., if you think it’s necessary or if you would like to challenge yourself.
Urban Life Club (ULC) is an innovative young firm that sells memberships to people who have an interest in certain products. People pay membership fees for one year and each month receive a product by mail. For example, ULC has a coffee-of-the-month club that sends members one pound of special coffee each month. ULC currently has five memberships (coffee, wine, beer, flowers, and computer games) each of which costs a different amount. When people join ULC, the customer needs to provide his/her information including the name, mailing address, phone number, e-mail address, credit card information, start date, and membership service(s) (e.g., coffee). The computer game membership operates a bit differently from the others. In this case, the member must also select the type of game (action, arcade, fantasy/ science-fiction, educational, etc.) and age level. Some customers request more products than the membership included (e.g., two pounds of coffee), in which case they will need to pay for the additional costs. ULC is planning to greatly expand the number of memberships it offers (e.g., video games, movies, toys, cheese, fruit, and vegetables) so the system needs to accommodate this future expansion.
In: Computer Science
Please, write code in c++. Using iostream and cstring library
Write a function that will find and return most recent word in
the given text.
The prototype of the function have to be the following void
mostRecent(char *text,char *word)
In char *word your function have to return the most recent word
that occurce in the text.
Your program have to be not case-sensitive(ignore case -
"Can" and "CAN" are the same
words)
Also note than WORD is sequence of letters sepereated by
whitespace.
Note. The program have to use pointer.
Input:
First line contains one line that is not longer than 1000 symbols
with whitespaces.
Output: The most recent word in UPPER case.
example:
Input:
Can you can the can with can?
output:
CAN
In: Computer Science
Write a function treble that takes a pointer to an integer and
triples its value. Note that this function does not return
anything. You can test it using the following example or something
similar:
int i=7;
cout << "old value; i="<<i<< "-"
treble(&i);cout <<"New Value:i="<< i
<<"\n";
Which prints: Old vvalue:i =7 - new value: i=21
In: Computer Science
Pick any simple game that is played on a mobile device or desktop/tablet or game console. For this discussion you should consider the pros and cons of playing the same game using different interfaces. Select two interfaces, other than the GUI and mobile ones (e.g. tangible, wearable, and shareable) and describe how the game could be redesigned for each of these, taking into account the user group being targeted. For example, the tangible game could be designed for young children, the wearable interface for young adults, and the shareable interface for elderly people.
In: Computer Science
Use any C program without using PTHREADS calculate time taken to execute program.
|
critical section |
|||
|
mutex solution |
|||
|
semaphore functions |
|||
|
Barriers |
|||
|
Read-Write Locks |
Run program using 1, 2, 4, and 8 threads Comparison study
|
Number of threads |
||||
|
Implementation |
1 |
2 |
4 |
8 |
|
critical section |
||||
|
mutex solution |
||||
|
semaphore functions |
||||
|
Barriers |
||||
|
Read-Write Locks |
||||
In: Computer Science
Draw a Schema Diagram using the information.
Signum Libri (SL) is a publishing company.
SL Operations Database will keep track of the following:
In: Computer Science
Write a C++ program that involves implementing the RSA cryptosystem. In practice for the encryption to be secure and to handle larger messages you would need to utilize a class for large integers. However, for this assignment you can use built-in types to store integers, e.g., unsigned long long int. Also, rather than using the ASCII table for this assignment use BEARCATII, which restricts the characters to the blank character and the lower-case letters of the alphabet as follows: blank character is assigned the value 0. A, …, Z are assigned the values 1, …, 26, respectively. The message M will be represented by replacing each character in the message with its assigned integer base 27. For example, the message M = “TEST” will be represented as N = 20 5 19 20 Translating this to decimal we obtain: D = 20 + 19*27 + 5*272 + 20*273 = 397838 Note that to convert back to base 27, we simply apply the algorithm we discussed in class, i.e., the least significant digit (rightmost) is obtained by performing the operations D mod 27 and performing a recursive call with D/27. For the example above we obtain, 397838 / 27, 397838 mod 27 = 14734, 20 → 14734 / 27, 14734 mod 27, 20 = 545, 19, 20 → 545/27, 545 mod 20, 19, 20 = 20, 5, 19, 20 = N Find primes p and q by choosing positive integers at random and testing for primality using Miller-Rabin probabilistic algorithm. Your program should prompt the user to input a positive integer representing the public key e. If the user enters a number that is not relatively prime to n = pq, then have the user reenter and keep doing this until e and n are coprime, i.e., gcd(e,φ(n)) = 1. Also prompt the user to enter the message M (as a character string). For handing purposes, run your program with M = “TEST”. Output p, q, n, M, C, P where C is the encrypted message, i.e., cyber text, and P is the decrypted message, i.e., plaintext. If your program is working correctly then M should be equal to P.
In: Computer Science