#Python:
>>>
Please enter a string: eve
Your string "eve" is a palindrome.
>>> testPalindrome()
Please enter a string: end
Your string "end" is not a palindrome.
>>> testPalindrome()
Please enter a string: 100921
Your string "100921" is not a palindrome.
>>> testPalindrome()
Please enter a string: 10401
Your string "10401" is a palindrome.
>>>
In: Computer Science
Explain an example in which a variable has two different addresses at different places in a program.
In: Computer Science
Describe the process of STP from implementation to convergence.
In: Computer Science
Convert the following numbers as indicated. Use as few digits in
the results as necessary or as many as indicated in the problems
(note: don't use table lookup).
a) (011011101)2 to Base 10
b) (-69)10 to binary 2's
complement representation using 9 bits
c) (75.3125)10 to unsigned
binary
d) (-152)10 to hexadecimal 2’s
complement representation
In: Computer Science
Java program to implement the merge sort your own and test it to sort a list of names based on the frequency.
In: Computer Science
CODE IN C++ PLEASE
Write a program to implement the algorithm that you designed in Exercise 19 of Chapter 1. Your program should allow the user to buy as many items as the user desires. Instructions for Exercise 19 of Chapter 1 have been posted below for your convenience. Exercise 19 Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200 or more, then the shipping and handling is free; otherwise, the shipping and handling is $10 per item. Design an algorithm that prompts Jason to enter the number of items ordered and the price of each item. The algorithm then outputs the total shipping and handling fee, and the billing amount. Your algorithm must use a loop (repetition structure) to get the price of each item. (For simplicity, you may assume that Jason orders no more than five items at a time.) An example of the program is shown below: Enter the number of items ordered: 3 Enter the price of item no. 1: 79.00 Enter the price of item no. 2: 23.50 Enter the price of item no. 3: 1.99 The shipping and handling fee is: $30.00 The billing amount is: $134.49 Since your program handles currency, make sure to use a data type that can store decimals with a decimal precision of 2.
In: Computer Science
In java based on the classes provided finish the program per the requirements:
----------------------------------------------Class1
package cardgame;
{
private String suit;// spades,diamonds,clubs,hearts
private int value; // 1 to 13
public static final String[] SUITS
={"clubs","hearts","diamonds","spades"};
/**
* @return the suit
*/
public String getSuit() {
return suit;
}
/**
* @param suit the suit to set
*/
public void setSuit(String suit) {
this.suit = suit;
}
/**
* @return the value
*/
public int getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(int value) {
this.value = value;
}
//you have to write two methods for random generation of suit and
value
public int ranSuit()
{
int value= (int)(Math.random()*4)+0;
return value;
}
public int ranValue()
{
int value= (int)(Math.random()*13)+1;
return value;
}
}
--------------------------------------------Class2
public class CardTrick {
public static void main(String[] args)
{
CardGame[] magicHand = new CardGame[7];//array of objects
for(int i=0;i<magicHand.length;i++)
{
CardGame c1 = new CardGame();//object
c1.setValue(c1.ranValue());//random number 1 to 13
c1.setSuit(CardGame.SUITS[c1.ranSuit()]);
magicHand[i] =c1;
}
for(int i=0;i<magicHand.length;i++)
{
System.out.println(magicHand[i].getSuit() +" "+
magicHand[i].getValue());
}
// take input suit and value from user. compare with
array.if same card is
//in the array print your card is found.
}
}
In: Computer Science
Digital security is an increasing concern is the Internet age. In order to protect sensitive information online, what are the methods for enhancing digital security? Select one method and describe in detail how it is implemented and how you would implement it to protect your online data.
In: Computer Science
Respond to the following in a minimum of 175 words:
The flow of a program is controlled by different structures. The three basic control structures in computer programs are sequence structures, decision structures (also called selection structures), and repetition structures (also called iteration structures).
Discuss the differences between decision structures and repetition structures used in algorithms. Provide examples of when you might use each.
In: Computer Science
Write a version of the binary search algorithm that can be used to search a string vector object. Also, write a program to test your algorithm. (Use the selection sort algorithm you developed in Programming Exercise 12 to sort the vector.) Your program should prompt the user to input a series of strings, ending the input stream with zzz. The program should then prompt the user to search for a specific string in the list. If the string is found in the list:
x is found in the list
else:
x is not in the list
*need answer in C++*
In: Computer Science
C# programming
Create a classes called AlphabetDice that simulates a multi-sided dices with alphabet characters on each side. For instance, a 10-sided AlphabetDice will random return 'a','b','c','d','e','f','g','h','i' or 'j'.
The custom constructor should require a random seed and the number of sides.
It should also have the following:
On a side note, to cast an integer to a char, use (char). e.g.
int x = 66;
char c = (char) x;
You can use the following in main to test your class:
AlphabetDice d = new AlphabetDice(999,4); // 999 is the seed
Console.WriteLine(d.Sides);
for(int i=0;i<100;i++)
Console.WriteLine(d.Next());
If your class is correct, adding the following line to the end of main should cause a compilation error:
d.Sides = 100;
Copy and paste the complete program here;
In: Computer Science
What are the trends in Distributed Systems?
In: Computer Science
Q2: Get SSN and the last name of married female employees who work on three or more projects Write Q2 in Relational Algebra:
In: Computer Science
When you create a C string (an array of chars) without the * symbol for pointer, is the pointer towards the 1st char created or not along with the array?
In: Computer Science
L= {w belongs to {0,1}* | the number of 0's is a prime number} . Prove that the language L is not regular.
In: Computer Science