where k is a 11-bit integer variable. Show the largest possible range in decimal for k that will not cause any overflow in sign-magnitude, one's complement, two's complement and excess-1023 respectively. Each range should be shown as "[min,max]" (without the quotes). The ranges should be shown in the given order and separated by comma, for example, [-1,2],[3,4],[-5,6],[7,8].
In: Computer Science
A process creates a child then it gives it 2 seconds to start in order for the child to register a handler for the SIGTSTP signal and stay alert for receiving the signal. Then the parent reads a command without options from the user and sends it to the child using a pipe then sends SIGTSTP signal to the child. The parent waits after that for the child to terminate then exits. The child handles the SIGTSTP signal by reading a command from the pipe and execute it using execlp system call. Write a C program to implement that logic using the signal handling system not sigaction.
In: Computer Science
Langton Ant Program:
This assignment will apply Langton's ant a two-dimensional universal turning machine on a 2 dimensional X by X grid where each grid cell is of the color white or black and the ant can be described as one of eight states ie. cell color and orientation.
Create a X by X square grid of “Cell”s that are either black or white. Begin with the “ant” in the center of the grid ( X must be a odd number/integer). Start the ant in a “up” orientation in the center of the board. Perform N steps where each step has to follow some simple rules:
You are to program the `Cell` class according to the following:
Cell color:
The `Cell` class will store the cell's color as a private member variable named `color` of type `CellColor` where `CellColor` is an enumeration data type defined as:
“enum CellColor {white, black};”
Constructor :
The `Cell` class will be constructed using the default constructor i.e. will not accept any arguments. The constructor will set `color` to `white` upon construction.
Cell Color Mutator
The `Cell` class will contain a public member function called `change_color` to change the `color` member. I.e. if `color` is set to `white`, calling `change_color( )` will change the `color` to `black`. The member function `change_color` will return type `void` and will accept no input parameters.
Cell Color Accessors
The `Cell` class will contain two "getter" functions to access `color`.
1.) Must be named `get_color`, will return type `CellColor`, must return the value of `color`, and must accept no input parameters. `get_color must return the value of `Cell`'s `color` member.
The template we will be using to declare the “Cell” class
Cell.hpp:
#include
// Declare an enumeration data type to store the Cell's color
enum CellColor {white, black};
// Declare the Cell Class
class Cell {
public:
// Declare default constructor to initialize color to white
// Declare member function getter for the color (get_color). Returns CellColor
// Declare a member to flip the color (change_color)
// Declare a member to print the string for this color.
// white = "0", black = "1"
private:
// Declare the color of this cell (color) as type CellColor
};
#endif
Cell.cpp:
#include "Cell.hpp"
(This is only part 1. of this homework assignment so I only need the code for this part I described and not the grid and ant movement yet)
In: Computer Science
In 200 words or more, Describe the role of due care and due diligence in terms of their role in reducing liability exposure.
In: Computer Science
hello!! So this is my CIS assignment, my professor is very hard to understand and he expects us to be perfect lol. I have tried to run this problem with a code but as you can see he wants to see that when the program is ran, all of the outcomes are listed all at once, the code that I have does meet the math part when it comes to the answers but as I said it does not show me all of my answers listed if not I have to put all of the inputs. also professor wants to see two different outcomes for example
income balance=-100
he wants to see income=nnnn
number of checks
bank fee=nnnn
in other words he wants to see me putting the income but he wants to see an additional.... (as part of the outcome)
I am really sorry but I have tried to go to tutoring and the time for me does not work......
A bank charges $10 per month plus the following check fees for a commercial checking account: $0.10 each for fewer than 20 checks $0.08 each for 20-39 checks $0.06 each for 40-59 checks $0.04 each for 60 or more checks The bank also charges an extra $15.00 if the balance of the account falls below $400 (before any check fees are applied). Write a program that asks for the beginning balance and the number of check written. Compute and display the bank's service fees for the month. Input Validation: Do not accept a negative value for the number of checks written. If a negative value is given for the beginning balance, display an urgent message indicating the account is overdrawn. The transaction data file: transaction.txtPreview the documentPreview the document Output: Beginning balance: $-100 Number of checks written: 30 Your account is overdrawn! The bank fee this month is $27.40 Beginning balance: $400.00 Number of checks written: -20 Number of checks must be zero or more. Beginning balance: $300.00 Number of checks written: 36 The bank fee this month is $27.88 Beginning balance: $300.00 Number of checks written: 47 The bank fee this month is $27.82 Beginning balance: $350.00 Number of checks written: 5 The bank fee this month is $25.50 Beginning balance: $300.00 Number of checks written: 70 The bank fee this month is $27.80
Reading data from a file
# include <iostream>
# include <iomanip>
# include <fstream>
using namespace std;
std; int main()
{ ifstream input;
input.open("transaction.txt");
while (input>>balance>>check)//while loop
{
//Processing the checks }
}//end while loop
/////////// he also provided with this, to include in the program.
thanks! for the help I really appreciate it
few days ago I got this answer:
//Please like and comment
//code.cpp
# include <iostream>
# include <iomanip>
# include <fstream>
using namespace std;
int computeCharge(int balance)
{
int charge = 10;
if (balance < 400)
{
charge += 15;
}
return charge;
}
float computCheckFee(int numberOfChecks)
{
if (numberOfChecks < 20)
{
return numberOfChecks * 0.10;
}
else if (numberOfChecks >= 20 && numberOfChecks < 40)
{
return numberOfChecks * 0.08;
}
else if (numberOfChecks >= 40 && numberOfChecks < 60)
{
return numberOfChecks * 0.06;
}
else
{
return numberOfChecks * 0.04;
}
}
float computeFee(int balance, int numberOfChecks)
{
return computCheckFee(numberOfChecks) + computeCharge(balance);
}
void getResult(int balance, int checks)
{
if (checks < 0)
{
cout << " Number of checks must be zero or more" <<endl;
}
else if (balance < 0)
{
cout << " Your account is overdrawn! The bank fee this month is $" << computeFee(balance,checks)<< endl;;
}
else
{
cout << " The bank fee this month is $" << computeFee(balance, checks) << endl;
}
}
int main()
{
ifstream input;
input.open("transaction.txt");
int balance = 0, check = 0;
while (input >> balance >> check)//while loop
{
cout << "Beginning balance : $" << balance << " Number of checks written: " << check;
getResult(balance, check);
}//end while loop
return 0;
}
//output
but when I run the program if you take a look at it it has "float computeFee(int balance, int numberOfChecks)" this part seems to be the problem because when I run the problem it says the variables are not declared. pls I need help!
In: Computer Science
Sort the given keys using Counting sort algorithm. Also write the algorithm.
5, 2, 3, 1, 0, 2, 1, 5, 0
In: Computer Science
I need this Java code transform to Python Code
PROGRAM:
import java.util.Scanner;
public class Main
{
static int count=0;
int calculate(int row, int column)
{
count++;
if(row==1&&column==1)
{
return 0;
}
else if(column==1)
{
return ((200+calculate(row-1,column))/2);
}
else if(column==row)
{
return (200+calculate(row-1,column-1))/2;
}
else
{
return
((200+calculate(row-1,column-1))/2)+((200+calculate(row-1,column))/2);
}
}
public static void main(String[] args)
{
int row,column,weight;
Main m=new Main();
System.out.println("Welcome to the Human pyramid. Select a row
column combination and i will tell you how much weight the person
is supporting");
System.out.println("Please type your selection for Row and
Column");
Scanner scan=new Scanner(System.in);
row=scan.nextInt();
column=scan.nextInt();
if(row==0 && column==0)
{
System.out.println("Thanks for playing Human Pyramid. Don't let me
down.");
System.exit(0);
}
if(row==0 || column==0)
{
System.out.println("Wrong option");
System.exit(0);
}
weight=m.calculate(row,column);
System.out.println("Person at ("+row+","+column+") is supporting
"+weight+" pounds");
System.out.println("Recursive function is called "+count+"
times");
}
}
In: Computer Science
i) Pen down the algorithm for Radix sort.
ii) What is the complexity of Radix sort?
iii) Give any 2 real time examples of Radix sort.
In: Computer Science
Using the Boyer-Moore algorithm, find the Bad Match table for the below patterns.
i) Pattern1: AABCACCCA
ii) Pattern 2: CCCAAABBD
iii) Pattern3: ABCABCBAD
iv) Pattern4: BSDGSBAA
In: Computer Science
Show the decimal integer -126 in 8-bit sign magnitude, one's complement, two's complement and excess-127 respectively in the given order, separated by comma.
In: Computer Science
Describe in detail five main images of the Android OS. Be sure to define what each part does for the overall OS.
In: Computer Science
convert 0xC2000000 into IEEE-754 single precision decimal format.
In: Computer Science
Explain in at least a paragraph
In: Computer Science
Answer these questions :
brief answers !!!!!!
adding examples in your report, such as iPhone x, Nexus 5, etc
__________________________________________________________________________________________
• Briefly describe various broadband Internet
connections
• Describe the purpose of an IP address and its
relationship to a domain name
• Describe features of browsers and identify the
components of a web address
• Describe ways to compose effective search text
• Explain benefits and risks of using online social
networks
• Describe uses of various types of websites
• Explain how the web uses graphics, animation,
audio, video, and virtual reality
• Explain how email, email lists, Internet messaging,
chat rooms, online discussions, VoIP, and FTP
work
• Identify the rules of netiquette
In: Computer Science
This is a ruby program, thank you Given a set of random integer numbers in a user-defined range, count the number of occurrences of each integer, and generate a histogram using # characters. The input and output of your program should match the following in format:
$ ./histogram.rb
How many random integer numbers do you want to generate?
10
Please input the maximum value for the random numbers:
9
The frequency of 1 | #
The frequency of 2 |#
The frequency of 3 |###
The frequency of 4 |#
The frequency of 6 |##
The frequency of 7 |###
The frequency of 8 |##
The frequency of 9 |####
Prompt the user to input the number of random integers to generate. Prompt the user to input the maximum value for the random integers. The minimum will always be 1 and the numbers generated should include the maximum value. Use the rand method available in Kernel to generate random numbers in a given range. The documentation for Random#rand is a bit more detailed than Kernel#rand, but it is the same method. Force the user input to be read from the line following the prompt in both cases. You must use an Array of the appropriate size to store the randomly generated numbers. In other words, if they ask for 50 random numbers, size the Array at 50. You must use a hash to store the frequency of each random number that is generated. HINT: Use a counting Hash. Do not generate lines in the histogram for numbers that are not found in the Array; note that there are no lines shown below for 5, 10, 16, and others. The numbers represented in the histogram should be in sorted order (low to high) when displayed. You must use an iterator method (which requires a code block) at least once in the program to iterate over the Array or the Hash (or both).
This is a ruby program, thank you
In: Computer Science