I am struggling to write a python script that
calculates the average length ,max length shortest length and
overall average length of of a snake and ladder game. I use python
3
The length is the number the dice is rolled until the max is
reached
We need a python script that calculates the number of moves it will take for a single player to reach 100. We have to simulate a snake and ladder game using python language. So one person plays the game several times and will compare the number of moves per each played game for us to be able to come up with the required data
In: Computer Science
describe and discuss the Software Development Life Cycle as it relates to creating software that will calculate the totals and dispense change for a cash register at a local grocery store
In: Computer Science
Ask the user to enter test scores. Once they have entered -1, print out the highest grade. Ensure that the grade entered is an integer.(Using Java Language)
Enter integers between 0 and 100, -1 when finished.
Enter a test score: [asdf]
Enter an integer.
Enter a test score: [32.5]
Enter an integer.
Enter a test score: [42]
Enter a test score: [99]
Enter a test score: [87]
Enter a test score: [x]
Enter an integer.
Enter a test score: [-1]
The max grade is: 99
In: Computer Science
c++
For your program, you will choose either the Selection Sort algorithm or the Insertion Sort algorithm and create a recursive implementation of that algorithm. Your program should:
In: Computer Science
In C language
Write a program that includes a function search() that finds the index of the first element of an input array that contains the value specified. n is the size of the array. If no element of the array contains the value, then the function should return -1. The program takes an int array, the number of elements in the array, and the value that it searches for. The main function takes input, calls the search()function, and displays the output. Name program part1.c
int search(int a[], int n, int value);
Example 1:
Enter length of array: 4
Enter elements of array: 8 2 3 9
Enter the value for searching: 2
Output: 1
Example 2:
Enter the length of the array: 6
Enter the elements of the array: 4 6 1 0 2 9
Enter the value for searching: 5
Output: -1
2. Modify the part 1 program so that it deletes all instances of the value from the array. As part of the solution, write and call the function delete() with the following prototype. n is the size of the array. The function returns the new size of the array after deletion (The array after deletion will be the same size as before but the actual elements are the elements from index 0 to new_size-1). In writing function delete(), you may include calls to function search(). The main function takes input, calls the delete()function, and displays the output. Name your program part2.c.
int delete(int a[], int n, int value);
Example 1:
Enter the length of the array: 6
Enter the elements of the array: 4 3 1 0 3 9
Enter the value for deleting: 3
Output array:
4 1 0 9
In: Computer Science
There are several typical cube computation methods such as Multi-Way, BUC, and Star-cubing. Briefly describe each one of these methods outlining the key points.
In: Computer Science
(dominoes N) which returns a list containing the (N+1)(N+2)/2 tiles in a double-N domino set, with each tile represented as a dotted pair (an improper list).
(dominoes 2) ⇒ ((2 . 2) (2 . 1) (2 . 0) (1 . 1) (1 . 0) (0 . 0))
using the programming language scheme
i need the question to be answered using the programming language Scheme
In: Computer Science
c++
Please read the whole question and instrucions.
The instructor wants a function to convert string to int to perform the bitwise operations then convert int to string back again to show results.
Question:Write a program that produces the
bitwise OR, bitwise AND, and bitwise XOR of the bit strings
1001 0011 1011 and 1111 1010 0000.
Thank you in advance.
In: Computer Science
C++ Zybook LAB15.3.1: What order? (function templates
Define two generic functions called GetVector() and CheckOrder(). GetVector() takes a string of items delimited by spaces and an item of a generic type (i.e., char, int, double, or string) and returns a vector of the given item type. CheckOrder() checks if the vector of items is in ascending, neither, or descending order. The function should return 'a' if the items are in ascending order, 'u' if the items are unordered, and 'd' if the items are in descending order.
To test your functions, you are provided a main program which: Reads items from the input one line at a time, Uses a function called DataType() to determine the type of data (e.g., char, int, etc.) in the line, Constructs a vector of the appropriate type using your GetVector() function, and Then calls your CheckOrder() to output how the items are ordered. The items can be different types, including integers, strings, characters, or doubles.
Ex. If the input is: bat hat mat sat 63.2 196.5 123.5 the output is: Order: a Order: u
Code:
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
using namespace std;
// TODO: Define a generic function called GetVector() that
// takes a string of items delimited by spaces and
// an item of a generic type (i.e., char, int, double,
// or string) and returns a vector of the given item
// type. The GetVector() function signature is below.
template <typename T>
vector<T> GetVector(string items, T item);
// TODO: Define a generic function called CheckOrder()
that
// takes a vector of either char, double, int or string
// type as an argument and returns 'a' if the contents
// of the vector is ascending, 'd' if descending and 'u'
// if it is neither. A vector of zero or one items is
// considered 'u'. The CheckOrder() signature is below.
template <typename T>
char CheckOrder(vector<T> v);
char DataType(string items);
int main(int argc, char* argv[]) {
// Read in items
string items, str_item = "";
char char_item = ' ';
int int_item = 0;
double double_item = 0.0;;
vector<string> sv;
vector<int> iv;
vector<double> dv;
vector<char> cv;
getline(cin, items);
while (!cin.eof()) {
// check for the type of data: DataType returns 'c' for char,
// 'd' for double, 'i' for int, and 's' for string
char type = DataType(items);
// populate the vector
switch (type) {
case 'c': cv = GetVector(items, char_item);
cout << "Order: " << CheckOrder(cv) <<
endl;
break;
case 'd': dv = GetVector(items, double_item);
cout << "Order: " << CheckOrder(dv) <<
endl;
break;
case 'i': iv = GetVector(items, int_item);
cout << "Order: " << CheckOrder(iv) <<
endl;
break;
default : sv = GetVector(items, str_item);
cout << "Order: " << CheckOrder(sv) <<
endl;
break;
}
getline(cin, items);
}
return 0;
}
char DataType(string items) {
bool chars = true;
bool strings = true;
bool ints = true;
bool doubles = true;
for (auto c : items) {
if (isalpha(c)) { ints = false; doubles = false; }
if (c == '.') { ints = false; }
}
if (ints) { return 'i'; }
if (doubles) { return 'd'; }
stringstream ss(items);
string s;
while (ss >> s) {
if (s.length() > 1) { chars = false; }
}
if (chars) { return 'c'; }
return 's';
}
In: Computer Science
Views are virtual in database but Materialized view are persistent. Discuss the need to have materialized view instead of views and in what condition No materialization if preferred.
In: Computer Science
Write a C++ program which performs a rot 13 substitution. Must be in C++. Thank you.
In: Computer Science
Scientific Computing course - I honestly dont know what this question means, we use python in this course. Not sure if that helps with answering this question.
Write an algorithm/pseudo code to transpose an nxn matrix.
In: Computer Science
Specify any four difference between Client/Server computing and Peer-to-Peer computing. Which architecture used by Bitcoin digital currency?
In: Computer Science
The Central Processing Unit consist of three main units. List these three units and discuss the functionality of each.
In: Computer Science
In: Computer Science