7. What are the applications of an Embedded and Real Time Systems.
8. Analyze in detail about the challenges in Embedded and Real-Time systems design.
9. What are the parameters to be considered while designing an Embedded System Process?
10. Why microprocessor/microcontroller is used in Embedded system.
In: Computer Science
In: Computer Science
Imagine you have a rotary combination lock with many dials. Each dial has the digits 0 - 9. At any point in time, one digit from each dial is visible.
Each dial can be rotated up or down. For some dial, if a 4 is currently visible then rotating the dial up would make 5 visible; rotating the dial down would make 3 visible. When 0 is the visible digit then rotating down would make 9 visible. Similarly, when 9 is visible then rotating up would make 0 visible.
We have devised a robotic finger to manipulate such combination systems. The robotic finger takes as input a String that indicates the operations to be performed. An L moves the finger one dial to the left, an R moves the finger one dial to the right, and a + rotates the dial that the finger is at up and a - rotates the dial that the finger is at down.
The robotic finger always starts at the leftmost dial.
Task 1: Basic Operations
Valid Sequence
Given a String that consists of (only) the characters L, R, + and -, determine if this String represents a valid sequence of operations.
A valid sequence of operations would not move the finger to the left of the leftmost dial or to the right of the rightmost dial.
public boolean validOperation(String ops, int numDials) {
Rotations
Given a sequence of operations in String form, as well as an initial arrangement of the dials, determine the digits that will be visible after the operations have been performed.
public int[] rotate(int[] initialState, String ops) {
Task 2: Finding Rotation Sequences
Given an initial state of the dials and a final state, return a String that represents a sequence of operations of shortest length that transforms the initial state to the final state.
public String getRotationSequence(int[] initialState, int[] newState) {
TEST CASE
@Test public void testValidOp1() { RoboticFinger rf = new RoboticFinger(); assertTrue(rf.validOperation("R++L++-RRR", 4)); } @Test public void testValidOp2() { RoboticFinger rf = new RoboticFinger(); assertTrue(!rf.validOperation("R++L++-RRR", 3)); } @Test public void testValidOp3() { RoboticFinger rf = new RoboticFinger(); assertTrue(!rf.validOperation("L-+R++RR", 10)); } @Test public void testValidOp4() { RoboticFinger rf = new RoboticFinger(); assertTrue(!rf.validOperation("RRR+-R+R+LL", 4)); } @Test public void testValidOp5() { RoboticFinger rf = new RoboticFinger(); assertTrue(rf.validOperation("RRR+-R+R+LL", 6)); } @Test public void testRotate1() { RoboticFinger rf = new RoboticFinger(); int[] initialState = {1, 2, 4, 4, 5}; String ops = "R++R-"; int[] expectedState = {1, 4, 3, 4, 5}; assertArrayEquals(expectedState, rf.rotate(initialState, ops)); } @Test public void testRotate2() { RoboticFinger rf = new RoboticFinger(); int[] initialState = {1, 2, 4, 4, 5}; String ops = "R++R-R-L++"; int[] expectedState = {1, 4, 5, 3, 5}; assertArrayEquals(expectedState, rf.rotate(initialState, ops)); } @Test public void testRotate3() { RoboticFinger rf = new RoboticFinger(); int[] initialState = {7, 0, 2, 9, 1, 5, 6}; String ops = "R-R++R+++R+RR--"; int[] expectedState = {7, 9, 4, 2, 2, 5, 4}; assertArrayEquals(expectedState, rf.rotate(initialState, ops)); }
@Test public void testGetRotationSequence1() { RoboticFinger rf = new RoboticFinger(); int[] initialState = {1, 2, 4, 4, 4, 7}; int[] finalState = {2, 7, 3, 4, 8, 9}; int expectedLength = "+R+++++R-RR++++R++".length(); String ops = rf.getRotationSequence(initialState, finalState); assertArrayEquals(finalState, rf.rotate(initialState, ops)); assertEquals(expectedLength, ops.length()); } @Test public void testGetRotationSequence2() { RoboticFinger rf = new RoboticFinger(); int[] initialState = {9, 9, 9, 9, 9, 9, 1}; int[] finalState = {2, 7, 3, 4, 8, 9, 2}; int expectedLength = 22; String ops = rf.getRotationSequence(initialState, finalState); assertArrayEquals(finalState, rf.rotate(initialState, ops)); assertEquals(expectedLength, ops.length()); } @Test public void testGetRotationSequence3() { RoboticFinger rf = new RoboticFinger(); int[] initialState = {5}; int[] finalState = {7}; int expectedLength = 2; String ops = rf.getRotationSequence(initialState, finalState); assertArrayEquals(finalState, rf.rotate(initialState, ops)); assertEquals(expectedLength, ops.length()); }
In: Computer Science
C++ programming
Create an application for generating lottery tickets of random numbers. Each lottery ticket has a fixed count of numbers to be played with each number selected being within a given range. For example, when the range of numbers is 1 through 100, and 5 numbers are to be played, the lottery ticket will be composed of 5 unique values between 1 and 100. The values are selected at random.
The main function is responsible for obtaining the upper range of the numbers and the count of numbers to be played from the end user. The count of numbers must be less than the upper range. The main function will call the generateLotto function to generate the lottery ticket and then call the displayTicket function to display the resulting lottery ticket. Any number of lottery tickets may be generated.
The generateLotto function should accept two parameters. The first should be the upper range for the numbers while the second parameter represents a count of the numbers to be played. For example, lotto(51, 6) will select 6 numbers at random between 1 and 51 (inclusive.) The function should return a vector of unique integer values in sorted order.
The displayTicket function accepts a vector of integers and displays the vector.
Hints: Although the standard library defines a rand() function for generating random numbers, the function may produce duplicate numbers and hence, is not suitable for this application. To ensure that unique values are generated, create a vector that contains all possible values (1 through the given upper range) and then shuffle these values using the random_shuffle() function. This will result in a vector of numbers between 1 and the upper range in random order. From this vector, select the required number of values from the beginning of the vector, adding these values to the result vector. Lastly, use the sort() function to sort the result vector.
The random_shuffle() and sort() functions require two parameters that specify the beginning and ending elements on which to operate. To specify the beginning and ending of the vector, the begin() and end() methods of the vector class can be used. For example, when the vector allNumbers contains all the values between 1 and 51, the values within the vector can be rearranged (shuffled) using: random_shuffle(allNumbers.begin(),allNumbers.end());
In: Computer Science
Write a C++ program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input (other than the sentinel).
Do the following:
1. Output the sum of all even numbers
2. Output the sum of all odd numbers
3. Output the count of all even numbers
4. Output the count of all odd numbers
You must use alternation ('if' statements), loops and simple calculations to do this. You must not use any arrays or vectors for this program.
In: Computer Science
In Exercises 1-9, prove each of the given statements from the given premises. You may use any of the following statements, with all occurrences of a letter replaced by a particular statement, as premises.
I) (P → S) ↔ ( ¬S → ¬P)
II) ¬Q ∧ (S ∨ Q) → S
III) ¬¬R ↔ R
IV) P → P ∨ R
In Exercises 1-7 use direct proofs.
2.) Premises: ¬S, P → S, ¬P ∨ Q → W
Prove: W
In: Computer Science
Write Arduino program to implement wiring three momentary switches to the Arduino board
In: Computer Science
The move for many businesses is to the cloud. Based on your reading, why do think this is the trend? What do you suppose some of the impacts of the repeal of Net Neutrality may have on this trend?
please give a one page answer description and also provide references
In: Computer Science
2) Write an algorithm to compute the area of circles. Your algorithm should prompt the user to take the number of circles and their radius values. Then it should compute the areas of each circle. Finally, your algorithm will print both radius and area of all circles into the output. [N.B. you need to use iterative statement for solving the problem. Consider Pi = 3.14159] Input: Area of how many Circles you want to compute? 3 Key in radius values: 2.5 3.12 2.16 Output: Radius is 2.5 and the Area is 19.63 Radius is 3.12 and the Area is 30.76 Radius is 2.16 and the Area is 14.65
C program
In: Computer Science
Software Engineering Subject
1. Discuss the four phases of the Rational Unified Process (RUP) and their relationship to the development activities such as requirements analysis, design, and testing.
In: Computer Science
Your task is to count the frequency of words in a text file, and return the most frequent word with its count. (Must use the code below without changing algorithms)
For example, given the following text:
there are two ways of constructing a software design one way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.
Based on the example your program should printout the
following along with the milliseconds to finish the
computing:
The most frequent word is "there" with 3 occurrences.
The code is below, it doesn't seem to printout what word is the most frequent and how many occurrences of it there are.
import java.io.File;
import java.util.Scanner;
import java.util.Map.Entry;
import java.util.AbstractMap;
import java.util.LinkedList;
public class WordCountLinkedList254{
public static Entry count_ARRAY(String[] tokens) {
int CAPACITY =
10000;
String[] words = new
String[CAPACITY];
int[] counts = new
int[CAPACITY];
for (int j = 0; j
< tokens.length; j++) {
String token = tokens[j];
for (int i = 0; i < CAPACITY; i++) {
if (words[i] == null) {
words[i] = token;
counts[i] = 1;
break;
} else if (words[i].equals(token))
counts[i] = counts[i] + 1;
}
}
int maxCount = 0;
String maxWord =
"";
for (int i = 0; i <
CAPACITY & words[i] != null; i++) {
if (counts[i] > maxCount) {
maxWord = words[i];
maxCount = counts[i];
}
}
return new
AbstractMap.SimpleEntry < String, Integer > (maxWord,
maxCount);
}
public static Entry count_LINKED_LIST(String[] tokens)
{
LinkedList> list =
new LinkedList> ();
for (int j = 0; j <
tokens.length; j++) {
String word = tokens[j];
boolean found = false;
/* for (int i = 0; i < list.size(); i++) {
Entry e = list.get(i);
if (word.equals(e.getKey())) {
e.setValue(e.getValue() + 1);
list.set(i, e);
found = true;
break;
}
}*/
int i = 0;
for (Entry e: list) {
if (word.equals(e.getKey())) {
e.setValue(e.getValue() + 1);
list.set(i, e);
i++;
found = true;
break;
}
}
if (!found)
list.add(new AbstractMap.SimpleEntry (word, 1));
}
int maxCount = 0;
String maxWord =
"";
for (int i = 0; i <
list.size(); i++) {
int count = list.get(i).getValue();
if (count > maxCount) {
maxWord = list.get(i).getKey();
maxCount = count;
}
}
return new
AbstractMap.SimpleEntry < String, Integer > (maxWord,
maxCount);
}
static String[] readText(String PATH) throws
Exception {
Scanner doc = new
Scanner(new File(PATH)).useDelimiter("[^a-zA-Z]+");
int length = 0;
while (doc.hasNext())
{
doc.next();
length++;
}
String[] tokens = new
String[length];
Scanner s = new
Scanner(new File(PATH)).useDelimiter("[^a-zA-Z]+");
length = 0;
while (s.hasNext())
{
tokens[length] = s.next().toLowerCase();
length++;
}
doc.close();
return tokens;
}
public static void main(String[] args) throws
Exception {
String PATH =
"/Users/jianguolu/Dropbox/254/code/dblp1k.txt ";
String[] tokens =
readText(PATH);
long startTime =
System.currentTimeMillis();
Entry entry =
count_LINKED_LIST(tokens);
long endTime =
System.currentTimeMillis();
String time =
String.format("%12d", endTime - startTime);
System.out.println("time\t" + time + "\t" + entry.getKey() + ":" +
entry.getValue());
tokens =
readText(PATH);
startTime =
System.currentTimeMillis();
entry =
count_ARRAY(tokens);
endTime =
System.currentTimeMillis();
time =
String.format("%12d", endTime - startTime);
System.out.println("time\t" + time + "\t" + entry.getKey() + ":" +
entry.getValue());
}
}
In: Computer Science
Topic: Artificial intelligence ( Artificial intelligence in society)
Assignment: You are expected to submit a typed, formal, full-sentence outline for your presentation. Consult notes from our class discussion on organization and outlining and the appropriate sections of the textbook for more information. Please also see the Informative Speech Formal Outline Example posted in Canvas in the section of Supplemental Materials. You must submit a typed, formal, full-sentence outline for your Informative speech in order for your Informative Speech to be reviewed and graded by the instructor.
An outline is not a manuscript but it should include sufficient detail so the reader can have more than a general idea of your presentation content. Your outline is required to include the Roman Numeral level and capital letter level of subpoint structure. You may also include the Arabic Numeral level of subpointing as well. Remember the "rule of 2" in your outline development. Your outline should not contain all ideas you present in your speech--it is a skeleton of the ideas--I assume you will say more than what appears on the outline. Accordingly, the outline should not contain so much content that it is essentially a manuscript of your speech.
Please cite your sources on the outline where they are used in the speech. Parenthetically reference the source on your outline following the cited ideas. Just including the source name is fine, provided there is no other source with the same name.
Attach a “References” page using APA format to your formal outline. Remember that Reference page entries are always listed alphabetically using the first character of the citation. Purdue OWL is an excellent resource to help you prepare accurate Reference pages. Use 11 or 12 point font in Times New Roman or Arial.
The Formal Outline is due no later than the date/time posted in Canvas and on the Tentative Class Schedule for the Informative Presentation and Outline. Please upload the Formal Outline to the appropriate assignment in Canvas.
Please also review the supplemental course information regarding plagiarism and be sure to avoid plagiarism anytime in this class and on researched assignments.
In: Computer Science
Need this in MS VISIO.
Based on the following narrative description, conduct the conceptual data modeling and draw an Entity-Relationship diagram according to the requirements of NCAA Men Basketball. You should specify the key and non-key attributes for each entity type. For relationship types, you should specify: (1) the (min,max) cardinality ratios (you can use any representation notation), and (2) the relationship attributes if it is necessary to include them. If you discover the narrative is incomplete, provide reasonable explanations to complete the story. Supply these extra explanations along with your diagram. However, none of the assumptions you make can nullify or contradict the business rules stated. NCAA Men Basketball NCAA wants to develop a database to keep track of information about college men basketball. Each team belong to a University and associate with one conference. Teams have their mascots. A conference has several teams. Each team can has maximum of 60 players and a minimum of 20 players. Each player can only play for one team. Each team has 6 to 10 coaches. A coach can work only for one team. Each year, NCAA will schedule a set of games for each team, and two games for any two teams (e.g., UC and Xavier). Four qualified referees are assigned to each game. NCAA would like to keep track of the details of each game; such as game schedule (i.e., date, time, and game-place), and referees assigned, participating teams, and the final score. Attributes for players include name, admission-date, year (such as freshmen, sophomore, etc), major, GPA, blood-type, and birthday. Attributes for coaches are name, title, salary, address, and phone. Attributes for referees are name, referee-ID, salary, year-of-service, address, and gender. NCAA also wants to keep track of the performance details of players who participated in each game, such as the position they played in that game and the personal score, assistants, and fouls. NCAA also records the day when the team joins a particular conference. Deliverable: E-R diagram of your conceptual data modeling (I will not accept late homework.) The ER diagram should be prepared by a software tool (e.g., MS Visio).
In: Computer Science
Complete the following functions in the Stack.java/Stack.h files
(ATTACHED BELOW):
a. void push(int val)
b. int pop()
c. int getSize()
public class Stack {
private int maxStackSize, topOfStack;
private int[] stack;
public Stack(int maxStackSize) {
if (maxStackSize <= 0)
System.out.println("Stack size should be a positive
integer.");
else {
this.maxStackSize = maxStackSize;
topOfStack = -1;
stack = new int[maxStackSize];
}
}
public void push(int val) { // complete this function
}
public int pop() { // complete this function
}
public int getSize() { // complete this function
}
}
In: Computer Science
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output.
Your code must contain at least one of all of the following control types:
Important! Consider which control structures will work best for
which aspect of the assignment. For example, which would be the
best to use for a menu?
The first thing your program will do is print a menu of choices for
the user. You may choose your own version of the wording or order
of choices presented, but each choice given in the menu must match
the following:
Menu Choice | Valid User Input Choices |
Enter/Change Character | 'C' or 'c' |
Enter/Change Number | 'N' or 'n' |
Draw Line | 'L' or 'l' |
Draw Square | 'S' or 's' |
Draw Rectangle | 'R' or 'r' |
Draw Triangle (Left Justified) | 'T' or 't' |
Quit Program | 'Q' or 'q' |
A prompt is presented to the user to enter a choice from the menu.
If the user enters a choice that is not a valid input, a message
stating the choice is invalid is displayed and the menu is
displayed again.
Your executable file will be named
Lab3_<username>_<labsection>
Your program must have at least five functions (not including main()) including:
*
*
*
*
*
*
If a square is to be printed, then the following
output is expected:
******
******
******
******
******
******
In case of a rectangle, we assume its width is
N+5. It should look like the following:
***********
***********
***********
***********
***********
***********
If the user selects Triangle, then it should
print a left justified triange which looks like the
following:
*
**
***
****
*****
******
Suggested Steps to Complete the Assignment:
You are not required to complete the following steps to write your
program or even pay attention to them. However, these steps will
give you an idea on how to create C programs that are stable and
need less debugging. If you do decide to use the suggested steps,
you should test your program thoroughly to ensure each step works
correctly before moving on to the next step.
In: Computer Science