Questions
In the previous verse, we asked the user to input 5 inventory items. In this verse,...

In the previous verse, we asked the user to input 5 inventory items. In this verse, we need to ensure the values they entered are valid values for the two fields of each inventory item. Continue to ask the user to input the inventory id # (integer) and the price (float) for 5 inventory items. After the user enters each value, ensure the value entered is greater than 0. If the value is less than or equal to 0, then write a descriptive error message and end the program. To end a program, call the exit function and pass 0 as an argument.

In: Computer Science

JAVA programing language: What is printed when the following code is executed? int columns; int rows;...

JAVA programing language:

What is printed when the following code is executed?

int columns;

int rows;

for(rows = 1; rows < 2; ++rows) {

for(columns = 1; columns < 3; ++columns) {

System.out.print("x");

}

System.out.println():

}

select one:

A)

xx

B)

xxx

xxx

C)

x

x

D)

xx

xx

xx

In: Computer Science

/* Assignment : Complete this javascript file according instructions in comments. */ // 1) Create a...

/* Assignment :
Complete this javascript file according instructions
 in comments. */

// 1) Create a for loop that loops through its code block 10 times
// In the first statement, set the variable i equal to zero
// In the second statement, tell the loop to execute while i is less than ten
// In the third statement, increment i by one each time the loop executes
// In the code block of the loop, print the variable i to the console



// 2) Create an array named foods and put your 5 favorite foods
// in the array as items.
// 5 fav foods = sushi, ramen, korean bbq, pizza, wings
// Create a for / in loop that will loop through the items in the foods array
// Print a favorite food item to the console each time the loop executes
// When finished, you should have printed each favorite food item to the console



// 3) Create a variable x and set it equal to 50.
// Create a while loop that executes while x is greater than zero.
// Print the value of x to the console every time the loop executes.
// Decrement the value of x by one every time the loop executes.
// Your loop should count backwards from 50 to 1 and print each number in the
// console.



// 4) Create a variable named myNum and set it equal to 10.
// Create a while loop that executes while myNum is less than 5.
// In the loop, print the value of myNum to the console.
// Below that loop, create a do / while loop.
// Set the while condition the same as first while loop.
// Print the value of myNum to the console in the loop.
// Comment below your loops to explain the outcome. /* multi-line comment */



// 5) Create a variable named x and set it equal to zero.
// Create a while loop that executes while x is less than ten.
// In the code block of the loop, set x equal to a random number between
// one and ten using the previous random number formula we learned with
// the Math object.
// After assigning x the random number, print the value of x to the console.
// The loop should continue to execute until the value of x equals 10.

In: Computer Science

c++ Create a program that creates a sorted list from a data file. The program will...

c++ Create a program that creates a sorted list from a data file. The program will prompt the user for the name of the data file. Create a class object called group that contains a First Name, Last Name, and Age. Your main() function should declare an array of up to 20 group objects, and load each line from the input file into an object in the array. The group class should have the following private data elements: first name ,last name age The group class should have the following functions: Constructor(s) Destructor - optional Get - read first name, last name, and age from an input stream Put - write last name, first name, and age to an output stream The group class should have the following operators: > < == compare the group to another group, using Last name, First name, then age, and return a bool Your program should do the following: Prompt the user for the name of the file Open the file Read the data into the array of group objects (maximum size 20) Close the file Sort the array Display the array ============== text file Ann ember 70 jacob Mark 68 David smith 45 Frank lee 37 John doe 30 Kathleen honor 34 bob ember 42 bob ember 13 Richard start 47 Susan hox 36 Expert Answer

In: Computer Science

THE FOLLOWING MUST BE CODED IN C THE FOLLOWING MUST BE CODED IN C THE FOLLOWING...

THE FOLLOWING MUST BE CODED IN C THE FOLLOWING MUST BE CODED IN C

THE FOLLOWING MUST BE CODED IN C   THE FOLLOWING MUST BE CODED IN C

Write a program that demonstrates handling pointers. Create two integer variables m and n, and two pointers, pm pointing to m, and pn pointing to n.

Produce the following output:

Address of m: 0x7ffcc3ad291c

Value of m: 29

Address of n: 0x7ffcc3ad291d

Value of n: 34

Now pm is pointed to m by assigning the address of m to pm

Address of pointer pm: 0x7ffcc3ad2100

Value of pointer pm: 0x7ffcc3ad291c

Content of pointer pm (dereferencing): 29

Now pn is pointed to n by assigning the address of n to pn

Address of pointer pn: 0x7ffcc3ad2101

Value of pointer pn: 0x7ffcc3ad291d

Content of pointer pn (dereferencing): 34

Thank you!

In: Computer Science

Prompt the user to input their lucky number. Upon getting the users input, validate that the...

Prompt the user to input their lucky number. Upon getting the users input, validate that the input is a valid number using Int32.TryParse (more info can be found at https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/how-to-convert-a-string-to-a-number (Links to an external site.)). If the input is not a valid number, output a message to the user stating that you are sorry but you are unable to run the FizzBuzz process due to the input not being a valid number. If the input is valid, you are clear to start the FizzBuzz process. If the input is divisible by 3, then output {number} Fizz. If the input is divisible by 5, then output {number} Buzz. If the input is divisible by 3 AND 5, output {number} FizzBuzz. If it is not divisible by either 3 or 5, simply just output the number.

In: Computer Science

Who do you think is “right": the SEDA paper or the “Events are a Bad Idea"...

  • Who do you think is “right": the SEDA paper or the “Events are a Bad Idea" paper and why? Justify your answer.
  • What is the difference between Mesa and Hoare Monitor semantics?
    • Which is simpler from the perspective of the application programmer?
    • Which is simpler from the perspective of the OS developer? Why?

In: Computer Science

Convert the following to Octal, hexadecimal and binary (long method(multiply and Divide by methods)) a.1364.367(10) b.1568.246(10)...

Convert the following to Octal, hexadecimal and binary (long method(multiply and Divide by methods))

a.1364.367(10)

b.1568.246(10)

c.846.578(10)

d.245.86(10)

e.2647.95(10)

In: Computer Science

////Fixme(1) add a statement to import ArrayList class public class ListManipulation { public static void main(String[]...

////Fixme(1) add a statement to import ArrayList class

public class ListManipulation {
public static void main(String[] args) {

//Fixme(2) create an ArrayList of integers and name the ArrayList list.

//Fixme(3) add the following numbers to the list: 10, 15, 7, -5, 73, -11, 100, 20, 5, -1

  
displayList(list);
System.out.println();
displayListBackwards(list);
  
  
}
  
public static void displayList(ArrayList<Integer> list) {

for(Integer i: list)
System.out.print(i + " ");
  
}
//Fixme(4) define a method displayListBackwards, which takes an ArrayList as a parameter and returns nothing.
//The method displays each element in the list in the reverse order, and adds a space after each element.



//Fixme(5) define a method maxElement, which takes an ArrayList as a parameter and returns the maximum element in the list.
  
  
//Fixme(6) define a method searchElement, which takes two parameters.
//The first parameter is an ArrayList and the second is an int type value.
//The method searches for value in the list.
//If the value is found in the list, the method returns its index, otherwise, it returns -1.


  
//Fixme(7) define a method eventCount, which takes an ArrayList as a parameter and returns the number of even element in the list.

}

In: Computer Science

Your friend wants to secure a desktop PC with a biometric access control. Provide several recommendations...

  1. Your friend wants to secure a desktop PC with a biometric access control. Provide several recommendations and explain the advantages and disadvantages of each.
  2. Identify your preferred recommendation and your reasons for making that recommendation.

In: Computer Science

What are the two basic communication paradigms used in the Internet? Give six characteristics of Internet...

  1. What are the two basic communication paradigms used in the Internet?
  2. Give six characteristics of Internet stream communication.
  3. Give six characteristics of Internet message communication.
  4. If a sender uses the stream paradigm and always sends 1024 bytes at a time, what size blocks can the Internet deliver to a receiver
  5. If a sender wants to have copies of each data block being sent to three recipients, which paradigm should the sender choose?
  6. What are the four surprising aspects of the Internet’s message delivery semantics?
  7. Give the general algorithm that a connection-oriented system uses.
  8. When two applications communicate over the Internet, which one is the server?
  9. Compare and contrast a client and server application by summarizing characteristics of each.
  10. What is the difference between a server and a server-class computer?
  11. Can data flow from a client to a server? Explain.
  12. What performance problem motivates peer-to-peer communication?
  13. Name two operating systems that offer the socket API.
  14. Once a socket is created, how does an application reference the socket?
  15. What are the main functions in the socket API?
  16. What is packet-switching, and why is packet switching relevant to the Internet?
  17. What is a communication protocol? Conceptually, what two aspects of communication does a protocol specify.
  18. What is a protocol suite, and what is the advantage of a suite?
  19. Describe the TCP/IP layering model, and explain how it was derived.
  20. List the layers in the TCP/IP model, and give a brief explanation of each.
  21. List major standardization organizations that create standards for data communications and computer networking.

In: Computer Science

give an arbitrary list of integers, how many are 3? (in scheme)

give an arbitrary list of integers, how many are 3? (in scheme)

In: Computer Science

Write a program in Python jupyter notebook for following: Part1: Course grade calculation: Course grades for...

Write a program in Python jupyter notebook for following:
Part1:
Course grade calculation: Course grades for CIS 1100 are calculated based on two assignments, a midterm exam, and a final exam. Here are the weights of these.

Assignments 25%

Midterm exam 35%

Final exam 40%

Ask the user for the scores they received for the two assignments, midterm exam, and the final exam. Then calculate and display their total weighted score they received for the course.

Based on the weighted score, calculate and display the letter grade. Here are the grading guidelines:

Score >=90: A

Score >=80: B

Score >=70: C

Score <70: F

Part 2:

The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here:

  • When you mix red and blue, you get purple.

  • When you mix red and yellow, you get orange.

  • When you mix blue and yellow, you get green.

Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than “red,” “blue,” or “yellow,” the program should display an error message. Otherwise, the program should display the name of the secondary color that results.

In: Computer Science

Write a function void reverse(char * s) that reverses the string passed as an argument. Your...

Write a function 
               void reverse(char * s)
that reverses the string passed as an argument. Your code should use pointer arithmetic (it may increment and decrement pointers, but it may not use array indexing). 
 
Here is a piece of code that shows the behavior of reverse:
char buf[100];
strcpy(buf, “hello”);
reverse(buf);
printf(“%s\n”, buf);  // output should be olleh
 
 

In: Computer Science

Calculate A+B, A-B, AxB, and A/B for each of the following pairs of binary numbers. (Assume...

Calculate A+B, A-B, AxB, and A/B for each of the following pairs of binary numbers. (Assume the first number in each pair = A and the second number =B). Append all numbers to 8 bits. Subtraction is not2’s complement.

a.1010101, 011010

b.101101, 10101

c.11001, 1100

d.1010101, 1110

In: Computer Science