execute coding examples that demonstrate the 4 scope rules
file,function,class,block
coding language c++
In: Computer Science
1. Read a line of input from the user (as a string) and find out if there are any vowels in the string. Use a break or continue keyword (whichever is appropriate) to notify that a vowel has been found. Prompt for another string and search again until the user enters 'exit' into the program.
2. Ask the user how many random numbers they would like to see. Ask the user to provide the lowest number they would like to use and the highest number. Only return integers between those two numbers.
Java language
In: Computer Science
Based on the following Python code, write a Python statement which outputs “December” when the value of the Month is 12 or “November” when the value of the Month is 11 or “Neither” when value of the Month is neither 11 or 12. The user enters the value which is store in the variable namedMonth.
Month = int(input("Please enter the value of the month in numerical format such as 11 for November, or 12 for December: " ))
sing Python
In: Computer Science
write a c++ program
Find an algorithm and show the codes for evaluating the number of numbers between 200 and 1000 that are divisible by 2 and 7
In: Computer Science
the language that suggested is java
- Given the following sorting techniques, that uses the algorithmic design techniques of Induction and Divide and Conquer paradigm:
a. Quicksort using pivot as the maximum element
b. Quicksort using a random pivot element
c. Quicksort using a pivot as the median element (Finding pivot in linear time)
d-insertion sort
e- merge sort
Perform the following tasks: A. Write the algorithm for each technique. B. Implement the code for each technique. C. Test your implemented code using the test cases provided in the next section. D. Compare the performance with respect to the time complexity of these algorithms against each other using the empirical results obtained in the previous task by plotting charts. E. Provide a technical analysis about the time complexity of these problems by using the charts from the previous task.
Input Cases: Problem instance size (n) a) For each technique, the size of n varies as 100, 1000, 10000, 100000 For each problem instance size, distinct input values should be randomly generated using the following specifications: b) Generate distinct random values between the range of: i. 1 and 500 ii. 100 and 1000 iii. 5000 and 100000 As such, for each problem you will have 12 executions (4 problem instance size each having 3 different input value generation range)
how to perform showing Analysis:
you will plot a single multi-line chart. The ticks on the x-axis
will represent each problem instance size
and y-axis will represent a count of the number of comparisons
performed for each technique given a
problem instance size. The series in these line charts will
represent the different sorting techniques you
have implemented. Use values generated between the range of 5000 to
100000 for each problems’
problem instance size.
In: Computer Science
How could this be implemented in C?
binstring[] = 1011001000010110000100010100110010010101101100011101000110010000100010100110010010101101100011101101000010001010011001001010110110001110001010011001001111100001000100010001000100010001
~ 160 characters long divided into groups of 5 ~
This function takes a starting position and the array of ‘1’ and ‘0’ and returns the character
representation of the five bits at that location.
char byte_at( int position, const char binstring[] ) {
}
In: Computer Science
Given a string sentence that consists of some words separated by a single space, and a string searchWord.
Write a function isPrefix to check if searchWord is a prefix of any word in sentence. A prefix of a string S is any leading contiguous substring of S. It returns the index of the word in sentence where searchWord is a prefix of this word (1-indexed).
If searchWord is a prefix of more than one word, return the index of the first word (minimum index). If there is no such word return -1.
Input: sentence = this problemo is an easy problemo, searchWord = pro
Output: 2
Explanation: pro is prefix of problemo which is the 2nd and the 6th word in the sentence, but we return 2 as it's the minimal index.
In: Computer Science
How to determine what type of attribute the following attributes are in an Entity-Relationship Model? I just want to know if each of these can be considered as a composite attribute, a multi-valued attribute or neither:
Suppose we have:
1. Name : A person's full name
2. Address : A residential address
3. Account Balance : A bank account balance
4. Monthly fees: Monthly fees associated with a chequing account, which are unique to each account holder
5. Minimum Balance: The minimum balance needed to maintain a chequing account, which is unique to each account holder
6. Interest Rate: Interest rate associated with a savings account that changes over time.
7. Loan Payment Amount: Amount paid towards a loan.
8. Date-Time: YYYY-MM-DD HH-MI-SS
9. Type of Transaction: Deposit or withdrawl from an account
10. Date of Birth: A person's date of birth
11. Date-Time: YYYY-MM-DD HH-MI-SS
12. Service Details: Details regarding the services a bank has provided for a customer
In: Computer Science
Explain Session Management in your OWN words.
In: Computer Science
in Java, I am writing a program where you need to pick a color. The color must be red, blue, or green and is a user input. If they put in a different value I need the program to stop running. So I essentially need to write code that says, if variableColor does not equal "red", "blue", or "green" then I need to print the statement "invalid response" and exit the program. How can I write this?
In: Computer Science
Compare and contrast the WiFi IEEE 802.11ax standard and latest Bluetooth standards. Your comparison should be based on technical specification and performance (e.g., data rate, modulation, range, no of channels and MIMO antenna, security features and other parameters; you should list as many as you can). Do you view WiFi and Bluetooth as competing or complimentary technologies? Justify your answer
In: Computer Science
Write an essay on "ONLINE CLASSES ISSUES AND CHALLENGES". The essay should be 250 to 300 words. The first paragraph includes the introduction of online classes. You can divide the essay into 4 paragraphs. These below topics are compulsory to discuss in the essay ( IMPORTANT NOTICE)
Points:
In: Computer Science
JAVA:
You're given two classes List.java and Node.java. In your List class you're supposed to implement the methods toFront, print, and toBack. The Node class is used as a reference no edit necessary.
LIST:
public class List {
protected Node head, tail;
/**
* Initialize the list to empty. Both head and tail
* are null references in this case.
*/
public List() {
// TODO Auto-generated constructor stub
head = tail = null;
}
/**
* Add nodeToAdd to the front (head) of this list.
* @param nodeToAdd to the front of this list.
*/
public void toFront(Node nodeToAdd) {
}
/**
* Print all nodes from the list to System.out
*/
public void print( ) {
}
/**
* Add nodeToAdd to the back (tail) of this list.
* @param nodeToAdd node to add at the back (tail) of this list.
*/
public void toBack (Node nodeToAdd) {
}
}
NODE:
public class Node {
protected String contents; // the contents of this LLNode
protected Node next; // Reference to next LLNode in list.
/**
* The constructor -- The default constructor will
* build a node with a null reference for the string
* and a null reference for the next item in the list.
*/
public Node() {
this(null, null);
}
/**
* Initializes this linked list node to the string
* given and sets the next reference to null.
* @param contents The string to store in this LLNode
*/
public Node(String contents) {
this (contents, null);
}
/**
* Initializes this linked list node to the string and
* LLNode reference passed in.
* @param contents The string to store in this LLNode
* @param next The reference to the next item in the List.
*/
public Node(String contents, Node next) {
this.contents = contents;
this.next = next;
}
/**
* @return the contents of this linked list node.
*/
protected String getContents() {
return contents;
}
/**
* @param contents the string to store in this linked list node.
*/
protected void setContents(String contents) {
this.contents = contents;
}
/**
* @return the reference to the next item in the Linked List
*/
protected Node getNext() {
return next;
}
/**
* @param next the Node to set as the node to follow this item in the list.
*/
protected void setNext(Node next) {
this.next = next;
}
}
In: Computer Science
Write an algorithm that doubles ALL the prime values of a linked lists, and then output the whole new list.
In: Computer Science
Code in c++, do not use loops, make it as simple as it can be. Thanks!
Background Well it has finally happened; AMC’s “The Walking Dead” has become a reality. The zombie apocalypse took place. It has been a couple of years since we have started to “rebuild” our society, and now is the time for you to be able to shine. We have come across technology that will allow for us to get back to life as it once was in the early 2000’s. Yes, we are still going to be 17 years back but it’s better than nothing. With all the Computer Scientists and Engineers that survived in the area, everything is almost back to normal except for the use of cell phones. People have been able to start-up businesses again, and we are trying to become as we once were. People work and get paid and of course we want the commodities that we once had. In a venture of remembering how people were glued to their cell phones you have decided to start a service. Why not!? You found a warehouse that had all the cell phones that you can distribute to those around in the area, and you have been working with others to get an infrastructure back. You now just have to come up with a quick system to be able to get people hooked before they get used to not having their phones anymore. With the fact that you must have a quick turn-around, you are putting together a simple plan and will later expand on the idea. You have everything ready to go and to sign people up, but you still need the billing to be generated. This is what you must work on now. You are only going to give users the options of two types of service, regular and premium.
To compute the rates you have the following established: 1. Regular service - $6.00 plus first 50 minutes free. Charges for over 50 minutes are $0.20 per minute. 2. Premium service - $15.00 plus: a. For calls made from 6:00am to 6:00pm, the first 75 minutes are free; charges for over 75 minutes are $0.10 per minute. b. For calls made from 6:00pm to 6:00am, the first 100 minutes are free; charges for over 100 minutes are $0.05 per minutes. Task Your task at the moment is to calculate and print out the bill for your customers. Your program should: 1. prompt the user to enter an account number, 2. a service code (type char), a. A service code of r or R means regular service b. A service code of p or P means premium service c. Treat any other character as an error 3. the number of minutes the service was used. Your program should output the account number, type of service, number of minutes the telephone service was used, and the amount due from the user. For the premium service, the customer may be using the service during the day and the night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service was used during the night. Concepts to follow: 1. Assign values to all constant variables that are associated with charges and number of minutes provided in the problem description. 2. The only information the user enters are: account number, type of service, minutes used, and day/night time minutes used based on the plan they have. 3. Remember you are dealing with money therefore should only have 2 decimal places. 4. You must use both a switch statement AND if/else, if/else if’s, or if’s as you see fit. 5. Keep in mind to check for input validation. If validation is incorrect you should have an error message and “kill” your program. 6. Do not use loops
In: Computer Science