Lab Text Manipulation
Inside the main method, do the following:
The output depends on the information provided by the user.
Please enter your favorite National Park or DONE to stop: mesa
verde
Please enter your favorite National Park or DONE to stop: black
CANYON of ThE gunnisON
Please enter your favorite National Park or DONE to stop:
DENALI
Please enter your favorite National Park or DONE to stop:
yellowStone
Please enter your favorite National Park or DONE to stop:
Done
Favorite National Parks: Mesa Verde | Black Canyon Of The Gunnison
| Denali | Yellowstone
In: Computer Science
Program #1: You will be writing code for several different examples of conditional execution. Each example should be written as a unique method. Each method should include a method header. So the basic outline of your code is: public class Branching { /** * This is an example method header. Notice how it's multi-line and written * using college-level English and not fragments - this is for the Human to * read and not the compiler to parse, so be verbose here. The purpose of this * main method is call the methods written for each of the parts of the *assignment. */ public static void main(String[] args) { methodA(); } public static void methodA() { /** *methodA header */ } A. Prompt the user with: "Enter a whole number". a. Determine if the number is negative and if so, print: "The number is negative." b. Determine if the number is positive and if so, print: "The number is positive." B. Ask the user for another whole number, and then determine if the number is even or odd. a. Hint: modulo might help. b. Print out a message that includes the number the user input as well as indicating if the number the user input was odd or even. C. Ask the user for a temperature, stored as an integer. Write an if/else statement that asks: Is the temperature higher than 78 degrees? If it is not, is the temperature less than (or equal to) 78 degrees? a. Describe the current temperature as “higher than 78 degrees” or “less than or equal to 78 degrees” D. Prompt the user for a letter grade and store this in a char. Then, write a multi-way if statement that ends in a tail-test, that asks the following questions: Is the grade an “A”? Else is the grade a “B”? Else is the grade a “C”? Else is the grade a “D”? Else is the grade an “F”? a. Notice the use of the word else in the sentence above, which provides for a more precise meaning. In spoken English we might use the word “or” instead, but of course, English is terribly ambiguous and Java needs to be discrete, deterministic, and precise. E. Rewrite your code for number D, but use a switch statement to accomplish the same thing. F. Prompt the user for two integer values and store them as “firstInteger” and “secondInteger”. a. Write an if/else statement that outputs either: “ firstInteger was larger than secondInteger” or “secondInteger was larger than firstInteger” on the console, based on the values provided by user that also includes the integer values in the output stament. b. If the values are equal, indicate this in an output that includes the values of the integers.
In: Computer Science
Step 1: Identify and Solve a Typical
Problem
There are a number of typical models in the Operations Research
field which can be applied to a wide range of supply chain
problems. Select one of the following typical
models:
• Travelling Salesperson Problem (TSP)
• Multiple Traveling Salesman Problem (mTSP)
• Knapsack Problem
• Vehicle Routing Problems (VRP)
• Job Shop Scheduling
• Parallel Machine Scheduling
• Christmas lunch problem
• Newsvendor problem
• Pickup and delivery
• Travelling thief problem
• Eight queens problem
• Minimum Spanning Tree
• Hamiltonian path problem
1.1. Background:
• Provide a detailed explanation of the selected problem.
1.2. Model
• Provide typical mathematical model of the selected problem and
clearly explain different aspects of the model (e.g. decision
variable, objective function, constraints, etc.)
1.3. Solving an Example
• Develop a mathematical model for a workable and
reasonable size of the problem.
– For many typical problems, when size of the problem increases, it
becomes NP-Hard. In other words, your computer will not be able to
solve it mathematically. Therefore, ‘workable and reasonable size’
here means that size of the selected problem should not be too
small or too large.
• Solve the problem in Excel and transfer your solution to Word. It
is required that details and steps of getting the solution are
provided in the Word document.
• Interpret the findings and discuss.
Step 2: LR on Application of Selected Typical Model in
Design and Analysis of Supply Chain
• Identify at least 5 peer reviewed articles in
which your selected typical problem has been employed to address
knowledge gaps in supply chain field.
– At least one of the selected articles should be published after
2010. • Write a comprehensive literature review on the application
of “your selected” typical model in design and analysis of supply
chain and address the following (but not limited to) points:
- What type of problems in supply chain can be addressed by the
selected typical problem?
– Compare similarities and differences of selected articles.
– Discuss the suitability of using the selected typical model in
design/analysis of various supply chains. – What are the
limitations of your selected typical problem? – Undertaking any
additional critical and/or content analysis on the application of
selected typical problem in design and analysis of supply chain is
highly recommended.
Step 3: Summary of Findings
• A summary of findings regarding the
strengths and weaknesses of the
selected typical problem in design and analysis of supply chain
should be summarised in this section.
In: Math
Racism, juries, and interactions: In a study of racism, Nail, Harton, and Decker (2003) had participants read a scenario in which a police officer assaulted a motorist. Half the participants read about an African American officer who assaulted a European American motorist, and half read about a European American officer who assaulted an African American motorist. Participants were categorized based on political orientation: liberal, moderate, or conservative. Participants were told that the officer was acquitted of assault charges in state court but was found guilty of violating the motorist’s rights in federal court. Double jeopardy occurs when an individual is tried twice for the same crime. Participants were asked to rate, on a scale of 1–7, the degree to which the officer had been placed in double jeopardy by the second trial. The researchers reported the interaction as F(2, 58) = 10.93, p < 0.0001. The means for the liberal participants were 3.18 for those who read about the African American officer and 1.91 for those who read about the European American officer. The means for the moderate participants were 3.50 for those who read about the African American officer and 3.33 for those who read about the European American officer. The means for the conservative participants were 1.25 for those who read about the African American officer and 4.62 for those who read about the European American officer. ***This prompt requires certain formatting so that you can draw tables and bar graphs. You can use Microsoft Excel or Microsoft Word, or any other word processing software to create your post/ post it as an attachment in the discussion. Draw a table of cell means that includes the actual means for this study. Do the reported statistics indicate that there is a significant interaction? If yes, describe the interaction in your own words. Draw a bar graph that depicts the interaction. Include lines that connect the tops of the bars and show the pattern of the interaction. Is this a quantitative or qualitative interaction? Explain. Change the cell mean for the conservative participants who read about an African American officer so that this is now a quantitative interaction. Draw a bar graph that depicts the pattern that includes the new cell means. Change the cell means for the moderate and conservative participants who read about an African American officer so that there is now no interaction. Draw a bar graph that depicts the pattern that includes the new cell mean
In: Math
The input file, “input.txt” is called parse Text.txt
Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we can not dedicate — we can not consecrate — we can not hallow — this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us — that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion — that we here highly resolve that these dead shall not have died in vain — that this nation, under God, shall have a new birth of freedom — and that government of the people, by the people, for the people, shall not perish from the earth.
In: Computer Science
//JAVA
//basic please for learning programming 2. Thank you.
Write the Class Variables
Class Box is to have the following private data members:
Write the following Overridden Method
Class Box is to have an overridden equals() method that does the
following:
Write the Get and Get Methods
Class Box is to have standard get/set methods for each data
member
Write the following Auxiliary Method
Class Box is to have an auxiliary method getVolume( ). The method
is to have an access of public and return a value of type double.
The method is to do the following:
Write the Constructors
Class Box is to have two constructors with the following
specifications:
Class: Box
Write the class header
Write the following Overridden Method
Class Box is to have an overridden toString() method that does the
following:
displays the following information in the format presented:
Height: display height of the object
Width: display the width of the object
Length: display the length of the object
Write the following application class: BoxApp.
Class BoxApp is to do the following:
Height: the value of the height property
Width: the value of the width property
Length: the value of the length property
In: Computer Science
Problem Description: Game: Bean Machine or Galton Box
To figure out if the ball falls to Left or Right, you can generate a random number using Math.random(). If this random number is greater than or equal to 0.5 we assume the ball falls to the Right otherwise it falls to the Left (or vise versa).
If there are 8 slots, the ball should hit 7 nails (8 -1), thus you should run a loop 7 times to figure out the path for that ball. If you have N balls, this whole process should be repeated N times. Here is a basic algorithm.
# of balls = N
# of slots = K
array of K elements
for ( i = 0 to N) {
int R = 0;
for (j = 0 to K-1) {
if ( random number >= 0.5)
R++;
}//end loop j
array[R] ++;
}// end loop i
Output the array to show how many balls are in each slot.
Things to DO!!!!!
Analysis: (3 points)
(Describe the problem including inputs and outputs in your own words.)
Design: (3 points)
(Describe the major steps in your algorithm for solving the problem.)
Coding: Write a well documented and properly indented Java source program. Your program should have a block comment with your name and a statement of purpose at the very top. Use meaningful variable names. You must have proper labels and informative statements for all inputs and outputs. (10 points)
Testing: (Describe how you test this program, you should use your own input data to test not just the test cases given in sample runs.) (4 points)
Test your program according to following test schedule and generate output to show the number of balls in each slot.
| N | K |
| 10 | 8 |
| 50 | 10 |
| 100 | 20 |
| 500 | 30 |
What to Submit:
In: Computer Science
C Programming Assignment 4
Cache Simulation
Objective:
To write a C program that simulates reading and writing to a custom-sized direct-mapped cache, involving a custom-sized main memory.
The program will read all values from the ZyLab as Test Bench inputs.
Main Menu Options:
The program simulates reading from and writing to a cache based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are:
Note that when you read from ZyLab, the input values are not displayed on the screen as they are in the sample run at the end of this document.
Inputs:
Input Value Checks:
Output Messages:
All messages should be display EXACTLY as shown in the sample run; that is, prefixed by three asterisks, a space and hyphen and one more space. The message should be followed by a blank line.
*** All Input Parameters Accepted.
Starting to Process Write/Read Requests
Note that one message has been deleted from previous versions of this Specification and three new ones have been added.
*** Error - Main Memory Size is not a Power of 2
*** Error - Block Size is not a Power of 2
*** Error - Cache Size is not a Power of 2
*** Error – Block size is larger than cache size
*** Error – Cache Size is not a multiple of Block Size
*** Error – Read Address Exceeds Memory Address Space
*** Error – Write Address Exceeds Memory Address Space (The write value following the invalid address value should be read and then discarded)
*** Error – Invalid Menu Option Selected (Until configuration data has been accepted, the only valid menu options that can be entered are “1” or “4.”)
Whenever any one of these errors occurs, the program should loop back to the Main Menu.
*** Word WW of Cache Line LL with Tag TT contains Value VV
This message should appear after all successful reads or writes
WW is the word number in the cache line, LL is the line number in the cache, TT is the line’s tag value and VV is the content value in the cache.
All values are in decimal.
*** Read Miss - First Load Block from Memory (followed on the next line by the Content Message above)
*** Cache Hit (followed on the next line by the Content Message above)
*** Write Miss - First Load Block from Memory (followed on the next line by the Content Message above)
*** Cache Hit (followed on the next line by the Content Message above)
*** Memory Freed Up – Program Terminated Normally
When option 4 is entered, the memory should be freed up and the message “Memory Freed Up – Program Terminated Normally”, followed by a blank line, should be displayed before exiting the program.
Program Requirements:
Each word i of main memory is initialized with the value M–i, where M is the size of main memory in words. So, memory location 0 will contain the address of the last memory location and the last memory location will contain the address of the first memory location (i.e. 0).
Prologue & Comments:
At the very beginning of your source code (the very first lines), please include a prologue which looks like the following:
/*
Dr. George Lazik (use your full name not mine)
Programming Assignment 4: Cache Simulation
Comp 222 – Fall 2019
Meeting Time: 0800-0915 (your meeting time)
*/
// Reading input values from ZyLab
// Determining the contents of memory
ZyLab Test Benches:
Make sure your full name appears on each page of the listing and that all pages are stapled together in their correct order BEFORE you come to class.
Failure to provide this listing will result in no grade for the assignment.
Sample Test Run
The following is a sample run of one of the tests in Assignment 4’s Test Bench on ZyBooks. Note: Some recently added error conditions are not included in this run.
1
65536
512
1024
1
65536
1027
16
1
65536
1024
15
1
65537
1026
4096
1
65536
1024
18
1
65536
1024
16
3
65535
14
2
65535
3
65534
512
2
1023
4
Your output
Programming Assignment 4: Cache Simulation
Comp 222 - Fall 2019
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter main memory size (words):
Enter cache size (words):
Enter block size (words/block):
*** Error - Block Size is Larger than Cache Size
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter main memory size (words):
Enter cache size (words):
Enter block size (words/block):
*** Error - Cache Size is not a Power of 2
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter main memory size (words):
Enter cache size (words):
Enter block size (words/block):
*** Error - Block Size is not a Power of 2
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter main memory size (words):
Enter cache size (words):
Enter block size (words/block):
*** Error - Main Memory Size is not a Power of 2
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter main memory size (words):
Enter cache size (words):
Enter block size (words/block):
*** Error - Cache size is not a multiple of block size
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter main memory size (words):
Enter cache size (words):
Enter block size (words/block):
*** All Input Parameters Accepted. Starting to Process Write/Read Requests
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter Main Memory Address to Write:
Enter Value to Write:
*** Write Miss - First load block from memory
*** Word 15 of Cache Line 63 with Tag 63 contains the Value 14
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter Main Memory Address to Read:
*** Cache Hit
*** Word 15 of Cache Line 63 with Tag 63 contains the Value 14
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter Main Memory Address to Write:
Enter Value to Write:
*** Cache Hit
*** Word 14 of Cache Line 63 with Tag 63 contains the Value 512
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
Enter Main Memory Address to Read:
Read Miss - First Load Block from Memory
*** Word 15 of Cache Line 63 with Tag 0 contains the Value 64513
Main Menu - Main Memory to Cache Memory Mapping
------------------------------------------------
1) Enter Configuration Parameters
2) Read from Cache
3) Write to Cache
4) Quit Program
Enter selection:
*** Memory Freed Up - Program Terminated Normally
In: Computer Science
Select 1 of the economic concentrations (clusters) below:
Write a 700- to 1,050-word paper evaluating economists’ assessments of the role the 4 factors of production played in determining how the economic concentration you selected has evolved. Complete the following in your paper:
In: Economics
A country experiences severe storms which destroys its main resource, oil rigs. Assume that the countries economy was in long-run equilibrium before this shock happens.
In: Economics