Hello, If anyone would be so kind as to help me out with a solution in either Java or C++ please and thank you !!!
Java code for he above question is provided below. Please comment if any doubt.
DomainProgram.java
package domainprogram;
import java.util.Scanner;
public class DomainProgram {
public static void main(String[] args) {
int[] arr=new
int[10];
Scanner sc=new
Scanner(System.in);
// Read 10 integers to
array
System.out.print("Please
enter 10 different integers:");
for(int
i=0;i<10;i++)
{
arr[i]=sc.nextInt();
}
// a) For all x,
ifx<0 then x is even
boolean
result=true;
for(int
i=0;i<10;i++)
{
int x= arr[i];
// If first condition is false the result is true
// If first condition is true and the second condition is false it
return false
// If first condition is true and the second condition is also true
it return true
if(x<0)
{
if(x%2!=0)
{
result=false;
break;
}
}
}
if(result)
System.out.println("a) is True");
else
System.out.println("a) is False");
// b) There exist some x
such that, if x<0 then x is even
result=false;
for(int
i=0;i<10;i++)
{
int x= arr[i];
// if first condition is true
if(x<0)
{
// If second condition is also true
if(x%2==0)
{
result=true;
break;
}
}
// if first conditionis false
else
{
result=true;
break;
}
}
if(result)
System.out.println("b) is True");
else
System.out.println("b) is False");
// c) There exist some x
such that, x<0 and x is even
result=false;
for(int
i=0;i<10;i++)
{
int x= arr[i];
// Check both conditions are true
if(x<0 && (x%2==0))
{
result=true;
break;
}
}
if(result)
System.out.println("c) is True");
else
System.out.println("c) is False");
// d) For all x such
that, x is one more than multiple of three
// or x is of the form
one more than a multiple of two
result=true;
for(int
i=0;i<10;i++)
{
int x= arr[i];
// Check any of the condition is false
if((x%3!=1)&& (x%2!=1))
{
result=false;
break;
}
}
if(result)
System.out.println("d) is True");
else
System.out.println("d) is False");
}
}
Output:
Hello, If anyone would be so kind as to help me out with a solution in...
Simplify the following sentences in predicate logic so that all the negation symbols are directly in front of a predicate. (For example, Vx ((-0(x)) + (-E(x))) is simplified, because the negation symbols are direct in front of the predicates O and E. However, Væ -(P(2) V E(x)) is not simplified.) (i) -(3x (P(x) 1 (E(x) + S(x)))) (ii) -(Vx (E(x) V (P(x) +-(Sy G(x, y))))) Write a sentence in predicate logic (using the same predicates as above) which is true...
Answer the following questions in the space provided below. 1. For each proposition below, first determine its truth value, then negate the proposition and simplify (using DeMorgan's laws) to eliminate all – symbols. All variables are from the domain of integers. (a) 3x, 22 <2. (b) Vx, ((:22 = 0) + (x = 0)). (e) 3xWy((x > 0) (y > 0 + x Sy)). 2. Consider the predicates defined below. Take the domain to be the positive integers. P(x): x...
Hello; I would greatly appreciate your help with providing a solution to a problem that I'm having trouble with. Thank you! Write a program that reads a set of integers and then finds and prints the sum of the even and odd integers. The numbers will be read in from the user via the cin statement. You do not know how many numbers the user may enter. When the user enters a 0 (zero), then the user is done entering...
true and false propositions with quantifiers. Answer the following questions in the space provided below. 1. For each proposition below, first determine its truth value, then negate the proposition and simplify (using De Morgan's laws) to eliminate all – symbols. All variables are from the domain of integers. (a) 3.0, x2 <. (b) Vr, ((x2 = 0) + (0 = 0)). (c) 3. Vy (2 > 0) (y >0 <y)). 2. Consider the predicates defined below. Take the domain to...
in python and can you tell me why i am wrong? Thank you ZyBooks Python M X zy cS 171: Computer x zy 11.9. LAB: Output x C Write A Program 1 x Slack | Hiu Nguy TG Python Program t x p ython - Getting x +. - 5 x € → e l earn.zybooks.com/zybook/DREXELCS171 Winter2020/chapter/11/section/9 Help/FAQ Kuanyu Lai - = zyBooks Bake My library > CS 171: Computer Programming home> > 11.9: LAB: Output values in a list...
please there are some specific instructions on the question so i would greatly appreciate if they are followed . thank you very much for your time This lab covers: arrays functions input exception handling Question 1 The purpose of this question is to write a python program (script) that manipulates arrays using vector arithmetic. You will compute the values of points The ellipse has a major axis whose length is a and a minor axis whose length is b. For...
Write a program to compute the product of two positive integers by repeated addition. Note: You are not allowed to use either multiplication or division operator. Understanding the Meaning of Multiplication: Multiplication of whole numbers can be thought of as repeated addition. // not allowed to use multiplication or division operator For example, suppose that a parking lot has 6 rows of parking spaces with 8 spaces in each row. How many parking spaces are in the lot? rows To...
Please help me the JAVA program - Choose Your Operation Write a program that uses a WidgetView object to do the following: Generate two random integers between 1 and 9 (inclusive). Name one of them x, the other y. Display them to the user using JLabel objects. Create a JLabel object displaying the text "Enter an operation number." Create a JTextField for the user's input. Create a JButton displaying the text "Press here when you've entered your operation." Use addAndWait...
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...
Please help me with the coding for LL(1)!! The given grammar was: P → PL | L L → N; | M; | C N → print E M → print "W" W → TW | ε C → if E {P} | if E {P} else {P} E → (EOE) | V (note: this has a variable O) O → + | - | * V → 0 | 1 | 2 | 3 (note: this has a terminal...