C++
12.18 Lab - Structs
In this lab, you will familiarize yourself with structs through a small exercise. We will be mixing the RGB values of colors together to make a new one.
RGB stands for red, green and blue. Each element describes the intensity value ranging from 0 - 255. For example: black color will have RGB values (0, 0, 0) while white will have (255, 255, 255).
Create an array of structs color. The struct contains three integers named red, green and blue. This corresponds to the RGB values of a color. For each array element, ask the user to enter the intensity value of red, green and blue. The value should be between 0 and 255 (inclusive).
*********The user can enter at most 10 colors. ********. see below for inputs
Additionally, compute the average of each of the red, green and blue components. For code modularity, implement a function that returns the average of each rgb component in your dynamic array. The function (called average) should take in a struct array, the rgb type for which you want to compute the average (as a string - red, blue or green) and its length. Print out the final result in the form (r, g, b), where r, g, b corresponds to each averaged value.
Can you guess what color you mixed? (Note: Your program does not need to print the final color mixed)
TEST #1
Input ------->>> 0 0 2 2 4 2
Expected output ----->>>> (1, 2, 2)
TEST #2
Input ------>>> 245 220 5 43 56 21 234 56 43
Expected output ----->>>> (174, 110, 23)
TEST #3
Input ------->>> 225 221 2 43 56 21 224 56 43 120 110 24 25 25 27
Expected output ----->>>> (127, 93, 23)
TEST #4
Input -------->>> 245 22 34
Expected output ----->>>> (245, 22, 34)

Answers

Answer 1

In order to input values choose between 0 up till 255 (integers)

Output

Number of colors to be analized:  2                                                                                                    

Write the amounts of RGB:  1:                                                                                                          

Red: 10                                                                                                                                

Green: 20                                                                                                                              

Blue: 100                                                                                                                              

                                                                                                                                     

Write the amounts of RGB:  2:                                                                                                          

Red: 30                                                                                                                                

Green: 20                                                                                                                              

Blue: 19                                                                                                                              

                                                                                                                                     

The colors average: (20, 20, 59)                                                                                                      

                                                                                                                                     

                                                                                                                                     

...Program finished with exit code 0                                                                                                  

Press ENTER to exit console.    

Code

#include <iostream>

using namespace std;

//declaration of variables

typedef struct Color {

   int b,r,g; //integers values which define a digital color

} Color;

//function of average

int average(Color *colors, int size, char type) {

   int s = 0;

   for(int i=0; i<size; i++) {

       if(type=='b') {

           s += colors[i].b;

       }        

       if(type=='g') {

           s += colors[i].g;

       }

       if(type=='r') {

           s += colors[i].r;

       }

   }

   return s/size;

}

int main() {

   int n;

   cout << "Number of colors to be analized:  ";

   cin >> n;

   Color *colors = new Color[n];

   for(int i=0; i<n; i++) {

       cout << "Write the amounts of RGB:  " << (i+1) << ":\n";

       cout << "Red: ";

       cin >> colors[i].r;

       cout << "Green: ";

       cin >> colors[i].g;

       cout << "Blue: ";

       cin >> colors[i].b;

       cout << endl;

   }

   cout << "The colors average: ";

   cout << "(" << average(colors, n, 'r') << ", " << average(colors, n, 'g');

   cout << ", " << average(colors, n, 'b') << ")\n";  

}


Related Questions

Create a function min_mid_max which takes a list as its formal parameter and returns a new list with the following characteristics: element 0 contains the minimum value • element 1 contains the middle value (not the median -- which would require an average if the list had an even number of elements). If the list is even (e.g. [1,2,3,4]) the 'middle' value will be the right value of the two possible choices (e.g. 3 rather than 2). • element 2 contains the maximum value Notes: • You can only use Python syntax shown so far (even if you know more) • You cannot use any math library (we have yet to see this) • You should use the function sorted. Remember the function sorted does not change its input, it returns a new list. • You should only need to call sorted one time. print(sorted(3,2,1])) • You can use the function int (another built in function) to help determine the index of the middle value. This function takes a floating point (or any kind of number) and converts it into an integer (e.g.print(int(4.32)). This will allow you to treat lists with an even number of elements the same as a list with a odd number of elements. • If min_mid_max is called with an empty list, return an empty list. • If min_mid_max is called with 1 item that item is the min, mid, and the max • If min_mid_max is called with 2 items, the mid and the max should be the same • No need to worry about the incoming list being the value None

Answers

Answer:

Follows are the code to this question:

def min_mid_max(myList):#defining a method min_mid_max that accept a list in parameter  

   if len(myList)==0:#defining if block that check list length equal to 0

       return []#return empty list

   s = sorted(myList)#defining variable s that uses the sorted method to sort the list

   m = int(len(myList)/2)#defining mid variable that hold list mid value

   return [s[0], s[m], s[-1]]#return list values

print(min_mid_max([1,2,3,4]))#use print function to call method  

print(min_mid_max([]))#use print function to call method

print(min_mid_max([1, 2]))#use print function to call method

print(min_mid_max([1]))#use print function to call method

Output:

Please find the attached file.

Explanation:

In the given code, a method "min_mid_max" is defined, which accepts a list "myList" in parameter, inside the method if block is used, that check length of the list.

If it is equal to 0, it will return an empty list, otherwise, a variable "s" is declared, that use the sorted method to sort the list, and in the "m" variable, it holds the mid number of list and returns its value.

In the print method, we call the above method by passing a list in its parameter.

In which setting would you be least likely to find a full-time A/V technician?



A.) stadium

B.) concert hall

B.) restaurant

D.) school

Answers

Answer: resturant

Explanation: Resturants are about making food, not about making electric. The answer to the question is resturant.

Hope this helps!

sa kumbensiyon naihalal si andres bonofacio bilang​

Answers

Answer:

the contemporary Supremo (supreme leader) of the Katipunan

We are designing a program that must do the following:
Read 3 integers from a file called "data.txt"
Sum the integers
Compute the mean of the integers
Output the mean to a file called "mean.txt".
We are required to select functions from the library provided below to complete our program. Inside of the main () function, fill in the correct C statements to satisfy the four requirements listed above. You must fill in all the lines labeled with "statement x", where x is 2, 3, 4, 5, or 6. The first statement has been completed for you.
// These are the library functions that we must invoke!
// Precondition: The input file must already be open.
int read_integer (FILE *infile)
{
int number = 0;
fscanf (infile, "%d", &number);
return number;
}

int calculate_sum (int number1, int number2, int number3)

{
int sum = 0;
sum = number1 + number2 + number3;
return sum;
}

double calculate_mean (int sum, int number)
{
double mean = 0.0;
mean = ((double) sum) / number;
return mean;
}
// Precondition: The input file must already be open.
void print_double (FILE *outfile, double number)
{
fprintf (outfile, "%0.2lf\n", number);
}
// Fill in the appropriate statements for main ().
#include
int main (void)
{
int n1 = 0, n2 = 0, n3 = 0, sum = 0;
double average = 0.0;
FILE *infile = NULL, *outfile = NULL;
// We will not check to see if files were opened successfully; assume they are
infile = fopen ("data.txt", "r");
outfile = fopen ("mean.txt", "w");
______n1 = read_integer (infile)_________________________ // statement 1
_________________________________________________________ // statement 2 (2 pts)
_________________________________________________________ // statement 3 (2
pts)
_________________________________________________________ // statement 4 (2 pts)
_________________________________________________________ // statement 5 (2 pts)
_________________________________________________________ // statement 6 (2
pts)
fclose (infile);
fclose (outfile);
return 0;
}

Answers

Data input

1. number1 = read_integer (infile) //read number1

2. number2 = read_integer (infile); //read number2

3. number3 = read_integer (infile); //read number3

Data treatment

4. values = calculate_sum (int number1, int number2, int number3);

5. average =  calculate_mean (int values, int number);

Output values

6. print_double (FILE *outfile, double average);

How can templates be made available to other users?

A: your user profile directory
B: a shared network location
C: an intranet SharePoint document library
D: none of the above

Answers

Answer:

b

Explanation:

Assignment
Create an HTML form that will accept four fields: pet name, pet ID, pet weight, and birthdate. Name this file petInfo.html. There should be a submit and reset button on your html form. Your input fields for your form should be inside of a table. The submit button should send the data to a php file named updateInfo.php. The updateInfo.php file should check the data submitted by the html file for proper formatting. While it is allowable that you may check input on the client side (either HTML or Javascript), you MUST check for valid input on the server using PHP.
***IMPORTANT***
Your POST variables in your HTML file must be labeled as follows. I have written an automated script to run tests on your code, and it depends on the POST variables being labeled correctly within the HTML Form.
1) "pet_name"
2) "pet_id"
3) "pet_weight"
4) "birth_date"
The following rules must be enforced by your PHP script about the input.
• No field is allowed to be blank.
• Maximum length of pet name is 20 characters.
• Pet ID must be 4 lowercase letters followed by 3 numbers. Example: abcd123
• Max length of pet weight is 7 characters. Max of two digits after decimal point. Must be a positive value. Range: 0.00 – 9999.99.
• The name should be only made up of alphabetical characters. (no numbers or symbols).
• Birthdate should be in the format 1/1/2002. Examples of valid input: 01/01/2002, 12/1/1999, 12/25/2015. Do not allow: 12/25/02 (The whole year should appear in the input).
If all the fields are valid, your PHP script should save the data into a file named petInfo.txt which should have the following format, and be sorted by "pet_name". Put each record on its own line. To simplify things, you can assume that Names are unique - i.e. you can use the name as a key for your associative array. (I won't use two of the same name when I test your code).
PetName, PetID, PetWeight, PetBirthDate\n
Once the new data has been received, you should also display ALL data that has been entered into the text file from your PHP script into an HTML table. The table should be sorted by last name just like the text file. After successfully displaying your table, create a link back to the petInfo.html page.

Answers

Answer:

it

is

not

a

big

question

it

is

so

simple

two page essay on an emerging technology.. plzzzzz help

Answers

Answer:

hope i get brainliest

Explanation:

Emerging Technologies

Abstract

The purpose of this paper is to summarize the advantages of computers/software and the use of computer technology in investigations. Summarize the disadvantages to law enforcement with respect to the advancements of computers. Real cases will be researched in order to understand how computers can be utilized in criminal activities, as well as a case that the use of a computer was beneficial to the prosecution in a criminal case. A final conclusion paragraph will address my personal subjective opinion as to whether these technologies, in an overall sense are a benefit or hindrance to law enforcement efforts.

Introduction

Since computers have become such a big part of our…show more content…

From utilizing computers in cars so officers could run a license plate and social security number to see if there are any warrants out for the person they stopped, to more advances such as carrying cell phones, GPS tracking systems in cars, crime mapping tools, information sharing between state and local law enforcement, to even sharing information across countries. Technology has come a long way in helping officers and other agents within the criminal justice system do their job.  

Just a bit more about the advantages of the things mentioned above and time to move on. The most interesting thing is Geographic Information Systems (GIS), which has become a most important tool for law enforcement agencies. GIS, other mapping software and desktop computers now are capable of mapping and data analysis that is way above and beyond what used to be possible with backroom mainframe computers (Rubley, 2011).

Another great advancement is the widespread use of everyone using mobile devices. Many officers now use two to three cell phones.

Write a short quiz program which asks three true/false questions and stores the user's answers as booleans. At the end the program it should print the user's answers with the correct answers.

Note: you should use the same quiz questions and correct answers as the sample run below.

Sample run:

Java is a programming language, true or false?
true
Only numbers can be stored by variables in Java, true or false?
true
There are only 2 possible values which can be held by a boolean variable, true or false?
false
Question 1 - Your answer: true. Correct answer: true
Question 2 - Your answer: true. Correct answer: false
Question 3 - Your answer: false. Correct
AP CS A Unit 1: Lesson 3 - Coding Activity 3

Answers

this answering question interface is bleh

The concept of boolean variables is that; variables declared as boolean type can only take any of two values. The variable can either be true or false. Such variable cannot take any other value apart from these two.

The short quiz program is as follows.

Please note that comments are used to explain difficult lines.

import java.util.*;

public class shortQuiz{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

//This declares the variables that represent correct answers as boolean data type; the variables are also initialized

 boolean q1 = true, q2 = false, q3 = true;

//This declares the response to each question as boolean data type

 boolean q1response, q2response, q3response;

//This prints the first question

 System.out.print("Java is a programming language, true or false? ");

//This gets input for the first response

 q1response = input.nextBoolean();

//This prints the second question

 System.out.print("Only numbers can be stored by variables in Java, true or false? ");

//This gets input for the second response

 q2response = input.nextBoolean();

//This prints the third question

 System.out.print("There are only 2 possible values which can be held by a boolean variable, true or false? ");

//This gets input for the third response

 q3response = input.nextBoolean();

//This prints your first response, alongside the correct answer to the first question

 System.out.println("Question 1 - Your answer: "+q1response+". Correct answer: "+q1);

//This prints your second response, alongside the correct answer to the second question

 System.out.println("Question 2 - Your answer: "+q2response+". Correct answer: "+q2);

//This prints your third response, alongside the correct answer to the third question

 System.out.println("Question 3 - Your answer: "+q3response+". Correct answer: "+q3);

//The program ends here

}

}

See attached image for program sample run.

The above program initializes the correct answers using boolean variables. The correct answers are then printed, after the user answers the three questions.

Read more about boolean variables at:

https://brainly.com/question/16843003

Which of the following is NOT a reason to include comments in programs?

a. Comments help the computer decide whether certain components of a program
are important.

b .Comments help programmers debug issues in their own code

c. Comments help document how code was written for other programmers to use

d. Comments enable programmers to track their work throughout the development
process

Answers

Answer:

A Would be correct!

Explanation:

The reason for this is because in a code when you use the comment out the compiler will skip over it and will not do anything and will skip it. So the comment can help the computer do anything!

HOPE THIS HELPED MAKE ME THE BRAINLIST!

Using programming concepts, the option that is NOT a reason to include comments in a code is:

a. Comments help the computer decide whether certain components of a program  are important.

-------------------------

Usually, codes are very long, and each person is responsible for a part of the problem. The parts have to be intervened with each other, and thus, sometimes a programmer will have to look at another part of the code, not coded by him. Thus, for the programmer and other people working in the project to understand, comments are important.Additionally, the comments are used to help the programmers debug their own code, as they can go part by part and see what is done in each part, also helping them work throughout the development process.In a program, there may be some components that end up not being necessary, but this is not decided by comments, and thus, option A is not a reason to include comments in programs.

A similar problem is given at https://brainly.com/question/13527834

Witch of the following involves unethical use of another intellectual property

Answers

Answer: the answer is C

hope you have a good day......    <3

Explanation:

Scenario: You are part of an IT group managing Active Directory for a mid-size organization. A contracted research group with their own IT team operating from a remote location with a slow network connection has requested that they be able to setup a Child Domain in your organization's domain. The remote IT teams argument is based on their slow network, and their need to access and administer the local server that would need to exist in their remote location. Your team is split between allowing the Child Domain or recommending an Organizational Unit and delegating the remote IT team access. Yours is the deciding vote -- and cost is being considered a deciding factor. What option do you support as the best option in this scenario? What DC configuration for the remotely located server would be the best option?
If instead of cost, the deciding factor was the slow speed of their network, what option would you support as the best option?

Answers

Explanation:

1.

the answer to the first question is organizational unit. this is because in this scenario that we have before us, cost is a deciding factor. a unit as this can adapt to changes, it is flexible and also not very complex

2.

answer to question 2 is PDC emulator. this emulator can perform the function synchronization of time across every domain controller that is in the domain. other of its functions are, authentication and changing of passwords.

3.

the answer to the 3rd question is child domain. It is a factor in this scenario because it works well in a situation where there is an issue of slow network connection.

what specific Philippine law discusses copyright? elaborate?​

Answers

Answer: Republic Act No. 8293 "Intellectual Property Code of the Philippines".

Explanation:

The Republic Act No. 8293 is the Intellectual Property Code of the Philippines. It is the Philippine law that discusses copyright. This law protects copyrights, intellectual property, trademarks, and patents.

Examples of copyright that are protected under the law are photographic works, drawings, audiovisual works, and cinematographic works.

The global communication network that allows computers to connect and pass through information is called?

Answers

Answer: Internet

Explanation:

Answer:

The Internet.

Explanation:

14. Convert 11110111 from binary to denary
(1 Point)

Answers

converting 11110111 from binary to denary = 247

Answer:

247

Explanation:

Carlie was asked to review a software project for her company to determine specific deadlines. Which part of project management must she consider?

Analysis
Resources
Scope
Time

Answers

Answer:

Resources

Explanation:

Answer:

scope

Explanation:

QUICK!!!

Which of the following occupations would work with oceanographers to better understand the relationship between the ocean and the
atmosphere?
1.research meteorologist
2. broadcast meteorologist
3. atmospheric scientist
4. forensic meteorologist

Answers

Answer:

I think the answer would be C. atmospheric scientist

How does multimedia content enhance a user’s Web browsing experience?

Answers

Answer:

hi

Explanation:

89

Answer:

I would say it is more engaging and helps the user remember the content better as multimedia is more memorable than just plain text. It can also display things that plain text is unable to, such as sounds and detailed pictures.

Explanation:

المساعد للWhat property of a metal describes its ability to be easily drawn into
a wire but not rolled into a sheet without splitting? iww.

Answers

Answer:

Ductility

Explanation:

PLEASE HURRY!!
Look at the image below!

Answers

The missing word is input. The input function asks the user to enter something and in this case, its asking for the user to enter the x-coordinate of the first point.

Create a class named FormLetterWriter that includes two overloaded methods named displaySalutation(). The first method takes one String parameter that represents a customer's last name, it displays the salutation "Dear Mr. or Ms." followed by the last name. The second method accepts two String parameters that represent a first and last name, and it displays the greeting "Dear" followed by the first name, a space, and the last name. After each salutation, display the rest of a short business letter: "Thank you for your recent order." Write a main() method that tests each overloaded method. Save the file as FormLetterWriter.java.

Answers

Answer:

Follows are the code to this question:

public class FormLetterWriter//defining class

{

static void displaySalutation(String last_Name)//defining a method displaySalutation  

   {

       System.out.println("Dear Mr. or Ms. " + last_Name);//print value

   }

   static void displaySalutation(String first_Name, String last_Name) //overload the method displaySalutation

   {

       System.out.println("Dear " + first_Name + " " + last_Name);//print value

   }

   public static void message()//defining a method message  

   {

       System.out.println("Thank you for your recent order.");//print message

   }

   public static void main(String[] args) //defining main method

   {

       displaySalutation("I Kell");//calling a method displaySalutation by passing a single String value

       message();//calling message method

       displaySalutation("Christ", "John");//calling a method displaySalutation by passing a two String value

       message();//calling message method

   }

}

Output:

please find the attached file.

Explanation:

In the above given program a calss "FormLetterWriter" is defined, in side the class we perform the method overloading, in which a method "displaySalutation" is used in first definition it accepts a single string variable "first_Name", and in second time, it accept two string variable " first_Name and last_Name".

Inside the both method, we use print method, that print its value, and an onther method message is defined, that print the given message.

In the class main method is declared, in which we apply mathod overloading and also call the message method for print the given business letter.  

A secure biometrics system authenticates the user based on his/her physiological (e.g., fingerprint, face, voice) or behavioral (e.g., gait, hand gesture, keystroke) traits. Typically, a binary classification model will be developed to generate predicted probabilities based on the input information. Please explain:

Answers

Answer:

The solution to this question can be defined as follows:

Explanation:

please find the complete question in the attached file:

In point a:

It utilizes multiple algorithms based on machine learning can understand the attributes or transform their probability into projections. Its algorithms could be used, including such neural computer systems or artificial neural networks. Whenever the input, as well as the target outcome, are taken their possibilities are converted in forecasts, so that if the input, as well as the corresponding results, are balanced.

In point b:

The operating curves of its receiver is indeed a plot of its true positives for its incorrect positive rate. It could be used in different tests for treatment. It indicates the variations of its responsiveness between all the two components and also the accuracy. Line slopes supply LR with a value.

Which holds all of the essential memory that tells your computer how to be
a computer (on the motherboard)? *
O Primary memory
Secondary memory

Answers

The answer is: B
Hope that helps have a nice day purr:)

Implement a class Balloon that models a spherical balloon that is being filled with air. The constructor constructs an empty balloon. Supply these methods:

void addAir(double amount) adds the given amount of air.
double getVolume() gets the current volume.
double getSurfaceArea() gets the current surface area.
double getRadius() gets the current radius.

Supply a BalloonTester class that constructs a balloon, adds 100cm^3 of air, tests the three accessor methods, adds another 100cm3 of air, and tests the accessor methods again.

Answers

Answer:

Here is the Balloon class:

public class Balloon {  //class name

private double volume;  //private member variable of type double of class Balloon to store the volume

 

public Balloon()  {  //constructor of Balloon

 volume = 0;  }  //constructs an empty balloon by setting value of volume to 0 initially

 

void addAir(double amount)  {  //method addAir that takes double type variable amount as parameter and adds given amount of air

 volume = volume + amount;  }  //adds amount to volume

 

double getVolume()  {  //accessor method to get volume

 return volume;  }  //returns the current volume

 

double getSurfaceArea()  {  //accessor method to get current surface area

 return volume * 3 / this.getRadius();  }  //computes and returns the surface area

 

double getRadius()  {  //accessor method to get the current radius

 return Math.pow(volume / ((4 * Math.PI) / 3), 1.0/3);   }  } //formula to compute the radius

Explanation:

Here is the BalloonTester class

public class BalloonTester {  //class name

  public static void main(String[] args)    { //start of main method

      Balloon balloon = new Balloon();  //creates an object of Balloon class

      balloon.addAir(100);  //calls addAir method using object balloon and passes value of 100 to it

      System.out.println("Volume "+balloon.getVolume());  //displays the value of volume by getting value of volume by calling getVolume method using the balloon object

      System.out.println("Surface area "+balloon.getSurfaceArea());  //displays the surface area by calling getSurfaceArea method using the balloon object

             System.out.println("Radius "+balloon.getRadius());   //displays the value of radius by calling getRadius method using the balloon object

     balloon.addAir(100);  //adds another 100 cm3 of air using addAir method

       System.out.println("Volume "+balloon.getVolume());  //displays the value of volume by getting value of volume by calling getVolume method using the balloon object

      System.out.println("Surface area "+balloon.getSurfaceArea());  //displays the surface area by calling getSurfaceArea method using the balloon object

             System.out.println("Radius "+balloon.getRadius());    }  }  //displays the value of radius by calling getRadius method using the balloon object

//The screenshot of the output is attached.

Easter Sunday is the first Sunday after the first full moon of spring. To compute the date, you can use this algorithm, invented by the mathematician Carl Friedrich Gauss in 1800:
1. Let y be the year (such as 1800 or 2001).
2. Divide y by 19 and call the remainder a. Ignore the quotient.
3. Divide y by 100 to get a quotient b and a remainder c.
4. Divide b by 4 to get a quotient d and a remainder e.
5. Divide 8 * b 13 by 25 to get a quotient g. Ignore the remainder.
6. Divide 19 * a b - d - g 15 by 30 to get a remainder h. Ignore the quotient.
7. Divide c by 4 to get a quotient j and a remainder k.
8. Divide a 11 * h by 319 to get a quotient m. Ignore the remainder.
9. Divide 2 * e 2 * j - k - h m 32 by 7 to get a remainder r. Ignore the quotient.
10. Divide h - m r 90 by 25 to get a quotient n. Ignore the remainder.
11. Divide h - m r n 19 by 32 to get a remainder p. Ignore the quotient.
Then Easter falls on day p of month n. For example, if y is 2001:
a = 6 h = 18 n = 4
b = 20, c = 1 j = 0, k = 1 p = 15
d = 5, e = 0 m = 0
g = 6 r = 6
Therefore, in 2001, Easter Sunday fell on April 15. Write a program that prompts the user for a year and prints out the month and day of Easter Sunday.
Part 1: Problem-Solving Phase
Using the Design Recipe, write each of the following for this problem:
Contract
Purpose Statement
Examples, making sure to include counter-examples
Algorithm (based on the above algorithm, completed with input/output steps)
Make sure to test your algorithm by hand with the examples to verify it before continuing to Part 2.
Part 2: Implementation Phase
Using Eclipse, write the Java program for the algorithm formulated in Part 1, and test your program with the examples from Part 1.
Make sure to incorporate your Contract, Purpose Statement and Examples as one or more comment blocks, and your Algorithm as line comments in your Java source code.

Answers

Answer:

The program written in Java without comment is as follows

import java.util.*;

public class MyClass {

   public static void main(String args[]) {

       Scanner input = new Scanner(System.in);

       System.out.print("Year: ");

       int y = input.nextInt();

       int a = y%19;

       System.out.println("a = "+a);

       int b = y / 100;

       System.out.println("b = "+b);

       int c = y%100;

       System.out.println("c = "+c);

       int d = b / 4;

       System.out.println("d = "+d);

       int e = b%4;

       System.out.println("e = "+e);

       int g = (8 * b + 13)/25;

       System.out.println("g = "+g);

       int h = (19 * a + b - d - g + 15)%30;

       System.out.println("h = "+h);

       int j = c/4;

       System.out.println("j = "+j);

       int k = c%4;

       System.out.println("k = "+k);

       int m = (a + 11 * h)/319;

       System.out.println("m = "+m);

       int r = (2 * e + 2 * j - k - h + m + 32)%7;

       System.out.println("r = "+r);

       int n = (h - m + r + 90)/25;

       System.out.println("n = "+n);

       int p = (h - m + r + n + 19)%32;

       System.out.println("p = "+p);

   }

}

Explanation:

I've added the full source code as an attachment where I use comments to explain difficult lines

What feature did the 32X add to the Sega Genesis?

Answers

Answer:

ngl why would i know this

Explanation:

It allowed the console to run 32-bit cartridges.

The Goal: Similar to the first project, this project also uses the random module in Python. The program will first randomly generate a number unknown to the user. The user needs to guess what that number is. (In other words, the user needs to be able to input information.) If the user’s guess is wrong, the program should return some sort of indication as to how wrong (e.g. The number is too high or too low). If the user guesses correctly, a positive indication should appear. You’ll need functions to check if the user input is an actual number, to see the difference between the inputted number and the randomly generated numbers, and to then compare the numbers.• Concepts to keep in mind: • Random function• Variables• Integers• Input/Output• Print• While loops• If/Else statements

Answers

Answer:

Here is the Python program:

import random #to generate random numbers

def generateRandNo(): #function to generate random number

    randNo = random.randint(1,100) #generates random number in range from 1 to 100

    return randNo #returns the generated random number

   

def userInput(message = "Guess the number "): #to gets integer input from user and return the input number

    userGuess = int(input(message)) #store the int type input from user in userGuess variable

    return userGuess #returns the user input number

   

def compareNumbers(userGuess,randNo): #compares the user input with actual randomly generated number

    if userGuess > randNo: # if user input is greater than actual number

         return "The number is too high"

    elif userGuess < randNo: #if user input is less than actual number

         return "The number is too low"

    else: #if user guess is correct

         return "Correct"

def main(): #main method

    correct = False #sets correct to False

    begin = True #sets start game i.e. begin to True

    while correct or begin: #while loop keeps repeating as long as user guess is correct or user wants to start game again

         guessCount = 0  #counts number of trials user takes to guess the correct number

         randNo = generateRandNo() #generates a random number using generateRandNo

         userGuess = userInput() #gets input number from user using userInput method

         guessCount+=1 #increments at each guess made by user

         message = compareNumbers(userGuess,randNo) #compares user guess input number with actual number

         

         while message != "Correct" : # while message is not equal to Correct

              print(message) #prints to guess the number

              userGuess = userInput("Try again: ") #keeps asking user to try again and enter a number

              guessCount = guessCount + 1 #increments guessCount  by 1 at each guess made by user

              message = compareNumbers(userGuess,randNo) #compares user input with actual number

         print()

         print(message,"It took you ",guessCount," attempts to answer\n") #prints how much trials user took to guess correct number

         choice = input("Do you wish to continue? (Enter yes or no) ") #asks user if user wants to start over

         if choice == 'no': # if user enters no

              exit(1) #exits the program

         else: #if user enters yes starts the game again

              correct = True #sets correct guess to True

main() #calls main method to start the guess game

Explanation:

The program is well explained in the comments attached with each line of the code. Suppose the randomly generated number (actual number) is 50 and user input is 24  then message The number is too low is displayed and if user guess input is 80 then The number is too high is displayed. If the user guesses the correct number i.e. 50 3rd time then the message displayed is:

It took you 3 attempts to answer.

The the user is asked to continue as:

Do you wish to continue? (Enter yes or no)

If user enters no the program exits if yes then user is asked to Guess the number again.

The screenshot of output is attached.

Could we represent every possible number with flippy do pro ?

Answers

Answer:

better with pro dud

Explanation:

.....helps??...

Implement a binary search function in three substantially different programming languages. In each program (identical, except for the programming language), carry out the same 10,000,000 unsuccessful searches for eight different-sized arrays, namely arrays of sizes 128, 512, 2048, 8192, 32768, 131072, 524288, and 2,097,152. Measure in each of the three programs the time it takes to do the 10,000,000 searches for each of the eight arrays. Compare these timings to the theoretical timings the algorithm binary search provides. Are there differences between the three programs? Explain your timings and observations!!

Answers

Answer:

The code to this question can be defined as follows:

Explanation:

C language code:

#include <stdio.h>//defining header file

int binarySearch(int x[], int l, int y, int z)//defining method binarySearch that accepts four integer parameter

{

if (y >= l)//defining if block that check r value is greater the l  

{

int m= l + (y - l)/2; //defining if block that holds mid value of array  

if (x[m] == z)//use if block  that check value in array

return m;// return array value

if (x[m] > z) //defining if block that check array value greater then x value

return binarySearch(x, l, m-1, z);//use return keyword to call method

return binarySearch(x, m+1, y, z);// in else it use return keyword to call method

}

return -1;//return value -1

}

int main()//defining main method

{

int x[] = {2, 3, 4, 10, 40};//defining array that hold integer values  

int n = sizeof(x)/ sizeof(x[0]);//use n variable to hold its size value

int z = 10;//defining x varaiable that hold integer value

int r= binarySearch(x, 0, n-1, z);//use r varaiable to hold method return value

if(r== -1) //defining if block that check its value equal to -1  

printf("Number is not foud in array ");//print message

else

printf("Number is present at %d position", r);//print value

return 0;

}

C++ language code:

#include <iostream>// header file

using namespace std;

int binarySearch(int x[], int l, int y, int z)//defining method binarySearch that accepts four integer parameter

{

if (y >= l)//defining if block that check r value is greater the l

{

int m= l + (y - l)/2; //defining if block that holds mid value of array

if (x[m] == z)//use if block  that check value in array

return m;// return array value

if (x[m] > z) //defining if block that check array value greater then x value

return binarySearch(x, l, m-1, z);//use return keyword to call method

return binarySearch(x, m+1, y, z);// in else it use return keyword to call method

}

return -1;//return value -1

}

int main()//defining main method

{

int x[] = {2, 3, 4, 10, 40};//defining array that hold integer values

int n = sizeof(x)/ sizeof(x[0]);//use n variable to hold its size value

int z = 10;//defining x varaiable that hold integer value

int r= binarySearch(x, 0, n-1, z);//use r varaiable to hold method return value

if(r== -1) //defining if block that check its value equal to -1

cout<<"Number is not foud in array ";//print message

else

cout<<"Number is present at position "<< r;//print value

return 0;

}

Python language code:

def binarySearch (a, x, r, y):#defining a method binarySearch

   if r >= x:#defining if block that checks r is greater than equal to x

       m = x + (r - x)//2#defining m variable that hold mid value

       if a[m] == y:#use if that check its input value equal y

           return m#return m value

       elif a[m] > y:#use array that check its value greaterthan y  

           return binarySearch(a,x, m-1, y) #use return keyword to call method

       else:#defining else block

           return binarySearch(a, m+1, r, y)#use return keyword to call method

   else:  #defining else block  

       return -1#return value -1

a = [ 2, 3, 4, 10, 40 ]#defining list a that holds value

y = 10#defining integer variable

r = binarySearch(a, 0, len(a)-1, y)#defining r variable that holds method value

if r != -1:#use if that check r is not equal to -1

   print ("Number is available at ", r," position")#print value

else:#else block

   print ("Number is not available in array")#print message

2. Which of the following fonts is most legible for a block of text? What font size and color would you choose if you were writing a block of text in a formal business document? (1 point)

Answers

Answer:

Color: Black

Font: Times New Roman

Size: 12

Explanation:

Answer:

Times new roman

front 12

color:black

Explanation:

Times new roman

front 12

color:black

(PYTHON)

Ask the user if they want to multiply two numbers entered from the keyboard. If they type "YES" ask for two numbers and multiply them. What happens if they type Yes, yes, yes, try a few combinations.

Answers

I hope this helps! If you have anymore questions, I'll do my best to answer them.

Other Questions
Help pls I dont think swing is the answer I will give brainliest in a survey of a group of people, it was found that 80 people like to drink tea 55 like coffee 25 like both and 30 people did not like both tea and coffee. Your mom still thinks Pluto is a planet, though it was downgraded to a "dwarfplanet" in 2006. Is she spacing out or experiencing: *Anchoring BiasBlind-spot biasConfirmation biasNegativity biasOutcome bias What provides the energy to add the phosphate group back to ADP to formATP?O oxygen we breatheO excerciseO ATP in food we eatO the food we eat For every pound a company spends on advertising, it spends 0.51 on its website. Express the amount spent on advertising to its website as a ratio in its simplest form. Suppose Sine (x) = four-fifths and cos(x) < 0. What is the value of cos(2x)?Negative StartFraction 14 Over 25 EndFractionNegative StartFraction 7 Over 25 EndFractionStartFraction 7 Over 25 EndFractionStartFraction 14 Over 25 EndFraction A bar of steel 340 cm long A team of college administartors caputured and atgged a group of 90 fraternity men and then returned them to the universiry campus. Later a group of soroity women wishing to stimate the amount of fraternity men on campus caputred 215 men and found they were tagged. How many frat men would they stimate that were on campus MP.1 Make Sense and PersevereThe Environmental Club's goal is to collect9,525 cans by the end of four months. Howcan you find the number of cans the clubneeds to collect in September to meet theirgoal? How many more cans do they need?MonthDATAJuneJulyAugusthow many more cans did they need A cellphone costs 120 dollars. The price is reduced 30 percent for a sale. How much is the saving OMG I NEED HELP NOWWW! THIS HAS TO BE QUICK SO I CAN CARVE PUMPKINS. HURRY AND HAPPY EARLY HALLOWEEN!! AND I NEED HELLP ASAP. THIS IS MY QUESTION:Emma is a biomedical engineer who designs robots that perform intricate surgeries. Into which two career clusters that we have considered so far could Emmas job fall? Give a reason for your choices. WORTH EXTRA PTSS!!! aka, this is career not medicine!!! Choose the response that shows the commas in the appropriate.The engineer admired the smooth workings of the large complex shiny gears in the machinery.a. The engineer admired the smooth workings of the large, complex, shiny gears in the machinery.b. The engineer admired the smooth workings, of the large, complex shiny gears in the machinery.CorrectC. what does a endoplasmic reticulum do? Pls answer quick, Ill give brainliest! Consider the following transactions for Huskies Insurance Company: a. Equipment costing $42,000 is purchased at the beginning of the year for cash. Depreciation on the equipment is $7,000 per year. b. On June 30, the company lends its chief financial officer $50,000; principal and interest at 7% are due in one year. c. On October 1, the company receives $16,000 from a customer for a one-year property insurance policy. Deferred Revenue is credited. Required: For each item, record the necessary adjusting entry for Huskies Insurance at its year-end of December 31. No adjusting entries were made during the year. (If no entry is required for a particular transaction/event, select "No Journal Entry Required" in the first account field. Do not round intermediate calculations.) answer my question plz im really stuck on it plz! Which of the following tables of values represent ordered pairs for the function f(x) = 2x 1?x 3 6 9 12 f(x) 6 12 18 24 x 2 4 6 8 f(x) 5 9 13 17 x 1 2 3 4 f(x) 1 3 13 17 x 0 4 8 12 f(x) -1 7 15 23 r.i.p walter wallace Jr Which characteristic of a substance is considered a chemical property?its boiling pointits reactivityits densityits conductivity Is -x-1 >= 2 The -x-1 is in the absolute value signs but I don't know how to add thoseChoicesAndOr All real number No soultion