DRAW A K-MAP FOR THIS SIX VARIABLE .
THE OUTPUT VALUES ARE,6,7,8,16,17,19,20,22,23,24,25,26,29,30,31,32,33,35,38,39,40,42,45,48,50,51,52,54,55,57,58,59,60,62,63)
DRAW K-MAP
LAYOUT OF K -MAP
SOP THANKYOU
In: Computer Science
Why wont my java program print out anything past "please enter a group of at least 5 integers"?
import java.util.Scanner;
public class MyStatistics {
public static void main(String[] args) {
// TODO Auto-generated method
stub
Scanner sc=new
Scanner(System.in);
System.out.println("Please enter a
group of at least 5 integers.");
String count_val =
sc.nextLine();
int[] int_array = new int[5];
int sum_val = 0;
int mean_val = 0;
System.out.println("Your input has
" + count_val.split(" ").length + " numbers");
//Input 5 Numbers
for(int x = 0; x < 10;
x++){
int_array[x] = sc.nextInt();
}
//Find the sum
for(int x = 0; x < 10;
x++){
sum_val = sum_val +
int_array[x];
}
//Find the average
for(int x = 0; x < 5;
x++){
mean_val = sum_val +
int_array[x];
}
System.out.println("The sum is: " +
sum_val);
System.out.println("The mean is: "
+ sum_val / 5);
}
}
In: Computer Science
The company publishes one regional magazine each in Upper North island (UN), Lower North island (LN), Upper South island (US), and Lower South island (LS). The company has 300,000 customers (subscribers) distributed throughout the four regions. On the first of each month, an annual subscription INVOICE is printed and sent to each customer whose subscription is due for renewal. The INVOICE entity contains a REGION attribute to indicate the customer’s region of residence (UN, LN, US, LS):
CUSTOMER (CUS_NUM, CUS_NAME, CUS_ADDRESS, CUS_CITY, CUS_REGION, CUS_SUBSDATE)
INVOICE (INV_NUM, INV_REGION, CUS_NUM, INV_DATE, INV_TOTAL)
The company is aware of the problems associated with centralized management and has decided that it is time to decentralize the management of the subscriptions in its four regional subsidiaries. Each subscription site will handle its own customer and invoice data. The management at company headquarters, however, will have access to customer and invoice data to generate annual reports and to issue ad hoc queries, such as:
• List all current customers by region.
• List all new customers by region.
• Report all invoices by customer and by region.
Given these requirements, how must you partition the database? How many fragments will you create? Design the database fragments for the INVOICE table and show two rows of sample data for each fragment.
In: Computer Science
matching Document or do not document A)indicate whether or not you need to document in the following situation:you change a lot of the wording of a paragraph.B)indicate whether or not you need to document in the following situation: you list the birthplace of George Washington.C)indicate whether or not you need to document in the following situation: you use a sentence from a speech you got from an audio web site.D) indicate whether or not you need to document in the following situation: you're not sure whether you should document a source or not.
In: Computer Science
Hi it's the java stack to convert from infix to postfix
If I want to fix this code to calculate each numbers not just displaying the numbers what should I do?
Would you help me to fix the result?
import java.util.Stack;
import java.util.Scanner;
class Main
{
//Function to return precedence
static int Prec(char ch)
{
switch (ch)
{
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
}
return -1;
}
static String infixToPostfix(String exp)
{
// initializing empty String for result
String result = new String("");
Stack<Character> stack = new Stack<>();
int i=0;
int len=exp.length();
for ( i = 0; i<len; ++i)
{
char c = exp.charAt(i);
if (Character.isLetterOrDigit(c))
result =result+ c;
else if (c == '(')
stack.push(c);
else if (c == ')')
{
while (!stack.isEmpty() && stack.peek() != '(')
result =result+ stack.pop();
if (!stack.isEmpty() && stack.peek() != '(')
return "Invalid Expression";
else
stack.pop();
}
else
{
//for operators
while (!stack.isEmpty() && Prec(c) <=
Prec(stack.peek()))
result =result+ stack.pop();
stack.push(c);
}
}
while (!stack.isEmpty())
result =result+ stack.pop();
return result;
}
public static void main(String[] args)
{
String exp = "(5+8)*(7-3)";
String exp2="6+7*(3+9)/2";
System.out.println("Infix "+exp);
System.out.println("Postfix "+infixToPostfix(exp));
System.out.println("Infix "+exp2);
System.out.println("Postfix "+infixToPostfix(exp2));
}
}
In: Computer Science
JAVA
Implement and test the following static recursive methods.
1) DigitCount – find the sum of the digits in an integer digitCount(12345) would be 5
2) Power2 - Efficiently compute exponentiation for non-negative exponents by the following recursive algorithm:
bx = 1 if x == 0
bx = (b(x/2))2 if x is even bx = b * (b(x-1)) if x is odd
3) Write a recursive method isBackwards that has two String parameters and returns true if the two Strings have the same sequence of characters but in the opposite order (ignoring white space and capitalization), and returns false otherwise. The method should throw an IllegalArgumentException if either String is null.
Test this method with following examples, isBackwards("Fried", "deirf") -> true isBackwards("Sit", "Toes") -> false isBackwards("", "") -> true
isBackwards("I madam", "mad am I") -> true
In: Computer Science
Using the following text string: axcbramneltodaydy
Search for the following pattern: 'today' Specify whether or not you found the pattern. The minimum requirement is to use the string STL, the brute force method and hard code both the text and the pattern.
For extra credit, you can add any of the following:
1. Do not use the string STL.
2. Allow me to enter both the text string and the pattern, including spaces. You can designate a special end-of-text character for me to include.
3. Use the Boyer-Moore algorithm instead of brute force.
4. Identify the location where the pattern was found within the text.
5. Allow for the possibility that the pattern can appear more than once in the text and identify all of the locations where the pattern was found.
In: Computer Science
Hi, how can I create a random guessing game in C++ with 2 players. I got some of the code but not working properly.
//Guess my number game
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int seed = time(0);
srand(seed);
int randomNumber = rand() % 100 + 1;
int userInput1, userInput2;
int counter = 0;
cout << "Welcome to Guess my Number" << endl;
do
{
cout << "PLAYER1 enter a
number: ";
cin >> userInput1;
cout << "PLAYER2 enter a
number: ";
cin >> userInput2;
if (userInput1 ==
randomNumber)
cout <<
"Congratulations you WON!" << endl;
else if (userInput1 >
randomNumber)
cout <<
"Winning number is lower." << endl;
else
cout <<
"Winning number is higher." << endl;
counter++;
cout << endl;
} while (userInput1 != randomNumber);
cout << "The winning number was " <<
randomNumber << endl;
cout << "Number of attempts. " << counter
<< endl;
system("pause");
return 0;
}
In: Computer Science
Use the function from Q1 to find the sum of ints,n, from 1 to 2500,
inclusive, that satisfy the following boolean:
((n div by 11) and ( n is div by 13) ) or (n is div by 61)
Print out the sum with a labelled print:
The sum of qualifying ints, n, 1 <= n <= 2500, is ___________.
Hint: Remember that you can use a for loop to traverse a list.
For example:
L = [23,37,41,53,61]:
for n in L:
print(n, end = ' ')
23 37 41 53 61
>>>
You can do this even more easily if you use the BIF sum, which returns the sum
of the numbers in a list
L1 = [2,7,13]
Sum = sum(L1)
print(Sum)
22
Write code to find the product of every 19th qualifying int (19th, 38th,...) from Q2, then
print out a labelled print:
The product of every 19th qualifying int is ____________
Then write code to find the sum of every 2nd qualifying int (2nd,4th,...) from Q2, then
print out a labelled print:
The sum of every 2nd qualifying int is ______________
Hint: Set up a counter and initialize the counter to zero.
Increase the counter as the ints from the list returned from Q2 are traversed.
Do not use indices - just use what has been taught. You can tell from the
counter what qualified int you are currently on. Knowing this, you can determine if
you are on a 2nd or a 19th qualifying int.
What is the largest int times the sum that is less than or equal to the product?
Print this out with a labelled print statement:
The largest int times the sum that is less that or equal to the product is _____________.
In: Computer Science
Write a script that accepts a single character argument (command line parameter), then checks to see if the argument is an upper- or lower-case letter. (You do not have to do any error checking. Just assume that the user will enter a single character.) Hint: use grep to search for a member of the character class [a-z]. Then use the exit code (in an if statement) to see if grep was successful and write the proper response. If the argument is a letter, print (display to screen) “You entered a letter.” If the argument is not a letter, print “You did not enter a letter.”
In: Computer Science
If you have a script called testscr, that you execute with the following pipeline:
echo two four six eight ten | testscr
and testscr contains the following lines of code:
# This is a read test
read parm1 parm2 parm3
echo :$parm1:$parm2:$parm3:
What gets printed?
In: Computer Science
Consider a file with a large number of Person(id, name, birth-date) records. Assume that users frequently search this file based on a the field id to find the values of name or birthdate for people whose information is stored in the file. Moreover, assume that users rarely update current records or insert new records to the file. Which file structure, heap versus sorted, provides the fastest total running time for users’ queries over this file? Explain your answer
In: Computer Science
Create a method called “concat” that takes three char array parameters. This method should concatenate the second string on to the end of the first string and store the result in the third string. Note: When you concatenate two string you add the contents of one string on to another. Important: Make sure you add null terminators where necessary. No pointer.C++
In: Computer Science
Yahtzee Simulation. Must be written in Python
These are the specific instructions:
"Write a function called Yahtzee_Simulation() that receives no parameters. The function will simulate rolling 5 dice at least one million times. It will keep track of the number of times the computer rolls a Yahtzee. The function will return the number of wins divided by the number of tries. There are no print() statements in this function.
Write a function called main() that receives no parameters. This function calls the Yahtzee_Simulation() function 10 times and prints the result of each simulation. Finally, print the mathematical result, which can be calculated with the following code: print(6/(6**5))"
This was also given as a hint:
The simulation runs 1000000 times 0.000774 0.000788 0.000729 0.000761 0.000777 0.000777 0.000777 0.000758 0.00077 0.000768 The mathematical solution is: 0.0007716049382716048
I've been struggling on how to do this, I think seeing an example of what it does and how it's made will help me when making my own, Thank you!
In: Computer Science
i used this coding for select image from database but the image did not retrieve from database and did not display
what is the issue ?
include "connect.php";
$sql= "select fileTmpPath
from picture where ID='3'";
$result =
mysqli_query($conn,$sql);
$pic=
mysqli_fetch_array($result);
echo " <img src=" .$pic["fileTmpPath"]."' />";
?>
In: Computer Science