Answer:
import java.util.Scanner;
public class TestClock {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter num 1");
double num1 = in.nextDouble();
System.out.println("Enter num 2");
double num2 = in.nextDouble();
System.out.println("enter \"s\" for addition\t \"d\" for difference\t \"p\" for the product\t and \"q\" for the quotient");
char op = in.next().charAt(0);
if(op =='s'||op=='S'){
double sum = num1+num2;
System.out.println("The sum is "+sum);
}
else if(op =='d'||op=='D'){
double diff = num1-num2;
System.out.println("The difference is "+diff);
}
else if(op =='p'||op=='P'){
double prod = num1*num2;
System.out.println("The product is "+prod);
}
else if(op =='q'||op=='Q'){
double quo = num1/num2;
System.out.println("The Quotient is "+quo);
}
}
}
Explanation:
- Use Scanner class to receive the two numbers and save in a two variables
- Create a new variable for Operation (op) to store a character
- Request the user to enter a character for the opearation (e.g s=sum, p=product, q=quotient and d=difference)
- Use if/else..if statements to implement the required operation
Answer:
Python 2:
with open("datafile") as myfile:
head = [next(myfile) for x in xrange(N)]
print head
Python 3:
with open("datafile") as myfile:
head = [next(myfile) for x in range(N)]
print(head)
Both Python 2 & 3:
from itertools import islice
with open("datafile") as myfile:
head = list(islice(myfile, N))
print head
Choose the web design factor from the drop-down menus that best represents each statement.
Answer:
A. Good web pages stick to the point, do not have useless information, and showcase important information.
B. The best websites clearly present a reason for the creation of the site.
C. The best websites are pleasing to look at and make you want to click further through the pages.
D. It is important for the web designer to understand the needs, interests, and technology level of the target web page visitor.
E. Good websites make it easy to navigate from one page to the other with relevant links in obvious places.
Answer:
you have the (while) code in whenever it is greater than 0, print hug. if less than, then nothing so flip the inequality thing around again.
Hope this helps plz hit the crown