As in previous prelabs, you can enter all the necessary Java code fragments into the DrJava Interactions pane. If you get an error, enter the corrected code. If you get really mixed up, you can reset the interactions pane and try again. Write a while loop that computes the sum of the first 10 positive integers. Write a for loop that computes the sum the first 10 positive integers. For each loop, you should use two variables. One that runs through the first 10 positive integers, and one that stores the result of the computation. To test your code, what is the sum of the first 10 positive integers

Answers

Answer 1

Answer:

public class Main{

public static void main(String[] args) {

 //The While Loop

 int i = 1;

 int sum = 0;

 while(i <=10){

     sum+=i;

     i++;  }

 System.out.println("Sum: "+sum);

 //The for Loop

 int summ = 0;

 for(int j = 1;j<=10;j++){

     summ+=j;  }

 System.out.println("Sum: "+summ); } }

Explanation:

The while loop begins here

 //The While Loop

This initializes the count variable i to 1

 int i = 1;

This initializes sum to 0

 int sum = 0;

This while iteration is repeated until the count variable i reaches 10

 while(i <=10){

This calculates the sum

     sum+=i;

This increments the count variable i by 1

     i++;  }

This prints the calculated sum

 System.out.println("Sum: "+sum);

The for loop begins here

 //The for Loop

This initializes sum to 0

 int summ = 0;

This iterates 1 through 10

 for(int j = 1;j<=10;j++){

This calculates the sum

     summ+=j;  }

This prints the calculated sum

 System.out.println("Sum: "+summ); }


Related Questions

Which of the following is a potential concern with having an online profile (1 point)
on your instant messaging service that contains personal information like
your address or favorite hobbies?
A.Your friends may not agree with what you write there.
B.You might misrepresent yourself.
C.You might become a target of users who wish to make inappropriate contact with you.
D.Your personal information might change.

Answers

Answer:

C. You may become a target of users who wish to make inappropriate contact with you.

Explanation:

15 points....How do you get money at home by just playing a vidio game.

Answers

You could become a creator or make an account on twitch

Streaming or you tube!

I personally am starting to stream within the new few years but creating content and streaming can make you money by getting subs, bits, and more :)

Write a SELECT statement that returns these four columns from the Products table: The list_price column A column that uses the FORMAT function to return the list_price column with 1 digit to the right of the decimal point A column that uses the CONVERT function to return the list_price column as an integer A column that uses the CAST function to return the list_price column as an integer Use column aliases for all columns that contain a function.

Answers

Answer:

See explanation below

Explanation:

SELECT list_price,

            FORMAT(list_price, 1) AS formatted_list_price,

            CONVERT(INT, list_price) AS converted_list_price,

            CAST (list_price AS INT) AS casted_list_price

 FROM products_table;

In SQL, the SELECT statement is used to initiate a query. It lists the variables that will be contained in the output, just like choosing items on a list, with each item being separated by a comma.

The FORMAT, CONVERT, CAST are all functions that are used to change the format of a value. Their formats are;

FORMAT - Format (value, decimal places)CONVERT - Convert (datatype, value)CAST -         Cast ( value AS datatype

In SQL, aliases are used to rename variables (usually those that contain functions) to ones taste. The AS is used after the function and the new name follows right after.

true or false with reason :- carriage inword is carriage on purchases​

Answers

Answer:

True

Explanation:

Carriage on purchases is carriage inward. Explanation: Carriage inwards refers to the transportation costs required to be paid by the purchaser when it receives merchandise it ordered with terms FOB shipping point. Carriage inwards is also known as freight-in or transportation-in.

:)

Implement a class named Rectangle. The class should contain:
1. Two data attributes of type float named width and height that specify the width and the height of the rectangle.
2. A constructor that creates a rectangle with the specified width and height. If no argument is provided, it should use 1.0 for both values. If any input value is negative, the function should raise an exception.
3. Functions get_width and get_height that return the corresponding value
4. The set_width and set_height function that update the values if and only if the input is positive; otherwise do nothing
5. Functions get_area and get_perimeter that return the area and the perimeter of this rectangle respectively.
6. A function rotate that swaps the height and width of a rectangle object.
7. A class variable count that keeps track of the number of rectangles created so far.
8. A class method get_count that returns the above value.
9. An equality operator that returns True if and only if the two rectangles are of the same shape.
10. A __str__ function that returns the information of this rectangle in some readable format.

Answers

Answer:

Explanation:

The following code is written in Python and creates a Rectangle class that performs all the necessary functions mentioned in the question...

from itertools import count

class Rectangle():

   _ids = count(0)

   width = 1.0

   height = 1.0

   def __init__(self, width, height):

       if (width < 0) or (height < 0):

           raise Exception("Sorry, no numbers below zero")

       else:

           self.id = next(self._ids)

           self.width = width

           self.height = height

   def get_width(self):

       return self.width

   def get_height(self):

       return self.height

   def set_width(self, width):

       if width > 0:

           self.width = width

   def set_height(self, height):

       if height > 0:

           self.height = height

   def get_area(self):

       return (self.height * self.width)

   def get_perimeter(self):

       return ((self.height * 2) + (self.width * 2))

   def rotate(self):

       temp = self.height

       self.height = self.width

       self.width = temp

   def get_count(self):

       return self._ids

   def equality(self, rectangle1, rectangle2):

       if rectangle1 == rectangle2:

           return True

       else:

           return False

   def __str__(self):

       return 'Rectangle Object with Height: ' + str(self.height) + ' and Width: ' + str(self.width)

What are the short comings of the Napier bones?

Answers

Answer:

Disadvantages of Napier's bone: It became tedious when the multiplication has to be done with big numbers. It was a much elaborate setup. It was made up of 200 rods placed in a special box.

how is what happened to fred hampton similar to what is going on in the news today

Answers

Hampton was shot and killed in his bed during a predawn raid at his Chicago apartment by a tactical unit of the Cook County State's Attorney's Office in conjunction with the Chicago Police Department and the FBI; during the raid, Panther Mark Clark was also killed and several others were seriously .

I like the impact that the increasing number of social grants may have on the things mothers​

Answers

Answer:

yes. i do too.

Explanation:

You are creating a Web document on a mobile device and will be out of your Internet Service Provider's coverage range for the remainder of the day. Which HTML5 API will allow you to continue working on the document?
This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task are A to H and alt+1 to alt+9.
A

Canvas
B

Offline Web application
C

Drag-and-drop
D

Geolocation

Answers

a, canvas yuh yuh yuh

Which visual aid best matches each description given?

population clusters within a particular country
✔ map

a cross-section of a cell membrane
✔ line drawing

the changes in cell-phone usage from 2000 to the present
✔ graph

an outline of the order of topics given in the speech
✔ handout

Answers

The changes in cell-phone usage from 2000 to the present

The options given above are all correct about the visual aid that best matches each description given.

What are Visual aids?

These are known to be any kind of thing or an instrument that is often used to portray an item or  one that helps people to know something or to remember something.

Conclusively, population clusters within a particular country can be depicted on a  map as well as the other options are also correct.

Learn more about visual aid from

https://brainly.com/question/3610367

What is the value of: 1 + int(3.5) / 2?
Select one:
a. 2
b. 2.25
C. 2.5
d. 3

Answers

Answer:

C (2.5)

Explanation:

int(3.5) = 3

So, using order of operations, (3/2)+1=2.5

The value of the expression value of: 1 + int(3.5) / 2 is known to be option C, which is (2.5).

What is the expression about?

In maths, an expression is known to be the composition of numbers, functions such as addition, etc.

Note that int(3.5) = 3

Therefore, using the given order of operations, (3/2)+1

=2.5

Therefore the answer =2.5 is correct.

Learn more about Expression  from

https://brainly.com/question/723406

#SPJ2

what is digital museum​

Answers

Access hundreds of professional development resources for museum professionals. Museum professionals can benefit at any career stage from student to retiree. Student Membership. Industry Membership. Established Since 1906. Museum Memebership. 501(c)3 Nonprofit Org.

Explanation:

1.Digital museum is a museum exhibition platform that utilizes computer and information technology, on which cultural relics and historical collections can be preserved and displayed in digital format. It is one of the main outcomes of digital curation. Learn more in: The Challenges of Digital Museum

true or false with reason :- profit and loss account is a real account​

Answers

Answer:

False

Explanation:

Account of expenses, losses, gains, and incomes is called the Nominal account. Profit and Loss Account contains all indirect expenses and indirect incomes of the firm. Therefore, Profit and Loss Account is a Nominal Account and not a real account.

:)

Develop a C program that calculates the final score and the average score for a student from his/her (1)class participation, (2) test, (3) assignment, (4) exam, and (5) practice scores. The program should use variables, cout, cin, getline(), type casting, and output manipulators. The user should enter the name of the student and scores ranging from 0 to 100 (integer) for each grading item. The final score is the sum of all grading items. The average score is the average of all grading items.

Answers

Answer:

#include <iomanip>

#include<iostream>

using namespace std;

int main(){

char name[100];

float classp, test, assgn, exam, prctscore,ave;

cout<<"Student Name: ";

cin.getline(name,100);

cout<<"Class Participation: "; cin>>classp;

while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; }

cout<<"Test: "; cin>>test;

while(test <0 || test > 100){  cout<<"Test: "; cin>>test; }

cout<<"Assignment: "; cin>>assgn;

while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; }

cout<<"Examination: "; cin>>exam;

while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; }

cout<<"Practice Score: "; cin>>prctscore;

while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; }

ave = (int)(classp + test + assgn + exam + prctscore)/5;

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

return 0;}

Explanation:

The required parameters such as cin, cout, etc. implies that the program is to be written in C++ (not C).

So, I answered the program using C++.

Line by line explanation is as follows;

This declares name as character of maximum size of 100 characters

char name[100];

This declares the grading items as float

float classp, test, assgn, exam, prctscore,ave;

This prompts the user for student name

cout<<"Student Name: ";

This gets the student name using getline

cin.getline(name,100);

This prompts the user for class participation. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

cout<<"Class Participation: "; cin>>classp;

while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; }

This prompts the user for test. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

cout<<"Test: "; cin>>test;

while(test <0 || test > 100){  cout<<"Test: "; cin>>test; }

This prompts the user for assignment. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

cout<<"Assignment: "; cin>>assgn;

while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; }

This prompts the user for examination. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

cout<<"Examination: "; cin>>exam;

while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; }

This prompts the user for practice score. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

cout<<"Practice Score: "; cin>>prctscore;

while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; }

This calculates the average of the grading items

ave = (int)(classp + test + assgn + exam + prctscore)/5;

This prints the calculated average

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

The IBM system/370 architecture uses a two-level memory structure and refers to the two levels as segments and pages, although the segmentation approach lacks many of the features described in Chapter 8. For the basic 370 architecture, the page size may be either 2 KB or 4 KB, and the segment size is fixed at either 64 KB or 1 MB. For the 370/XA and 370/ESA architectures, the page size is 4 KB and the segment size is 1 MB. What advantages of segmentation does this scheme lack

Answers

Answer:

Explanation:

Introductory thought:  

Thinking about the architecture for the IBM System/370 that is fit for giving higher preparing force and more stockpiling limit since it utilizes two-level of memory structure which is known as the segments and caches and the given plan is as per the following:  

In division the address space is isolated into quantities of segments of variable sizes and then again in paging the address space is partitioned into quantities of fixed-sized units that are known as pages.It is more helpful for better utilization of memory. The fundamental architecture for the IBM system/370 architecture the size of the page are for the most part either 2KiloBytes (KB) or 4KB and the size of the segments will be changed from 64KiloBytes to 1MegaBytes.   The two dissimilar kinds of architecture that existed are 370/XA that is the Extended Architecture, also the other is 370/ESA known as the Enterprise Systems Architecture.    The page size is 4KB for the Extended variant and 1MB for the Enterprise Systems Architecture (ESA).

Advantages of segmentation that the given scheme needs to incorporate includes:

In the configuration of the architecture for IBM System/370 the segments are of a fixed size which isn't noticeable for the programmer and as such he will know the interior subtleties and subsequently inside architecture is stowed away from outside gentle.  In IBM system/370 the reference bit is zero for the processor hardware as well as at whatever point another page is stacked into the edge, the reference bit is changed to one after referring to a specific area inside the casing.  The quantity of lines of the page outline table is overseen by the Operating System and a page outline table section is moved to start with one line then onto the next depending on the length of the span of the referenced bit from the page outline which is sets to nothing. Whenever there is a need to supplant the page then the page browsed the line of the longest life non referenced edges.

A(n) _____ is a legal right of ownership of intellectual property.

end-user license

agreement

free and software license

proprietary software license

copyright

Answers

Answer:

copyright

Explanation:

Copyright protects intellectual property. If you own a copyright, you own the legal rights to said property.

Answer:copyright

Explanation:

Use the drop-down menus to complete each of the following sentences correctly.

To include someone on an e-mail without others knowing, use the
feature.

Use the
feature to send a file.

Use the
feature to send someone else an e-mail you received.

To allow the main recipient of an e-mail to see who is being included in the message, use the
feature.


is a feature that can be used to respond to someone’s e-mail.

Answers

Answer:

Blind carbon copy (abbreviated Bcc)

Click on the menu item with a paperclip icon that says "Attach a file" or something similar (e.g., "Attach Files")

Click Reply and then select Forward

CC

reply

Which of the following terms is associated with instant messaging?
A. buddy list
B.subject heading
C.Save As
D.texting

Answers

D.

Texting is associated with instant messaging

Answer: A buddy list is a term that is associated with instant messaging (IM)

Have a wonderful day :D

Explanation:

state and explain application areas where computer are applied​

Answers

Answer:

There are at least five areas that are covered by computer applications, and five of those are business, government, military, manufacturing, and music. There are also other areas such as scientific and the role of technology in our society is growing annually.

Computers have now for several decades brought automation to the table in small, medium, and large businesses. There are word processing and spreadsheet applications for small businesses all the way up to enterprise-wide applications that cover every aspect of a large business such as accounting, inventory, shop floor, management, and feature real-time reporting capability that can give a snapshot glimpse of the financial position of a company at any point in time.

The government has a wide variety of computer applications. Government uses many of the same tools as small to large businesses in desktop type applications and many that are much more advanced that are used in the military.  Manufacturing applications involve computer-aided design and applications that are used to track production from the time a raw material is moved into the warehouse all the way to the production floor and back into the warehouse as a finished good.  

Military only applications include systems that use GPS in missiles to hone in on targets from miles away. There are all kinds of other applications some of which are secret in nature and the public does not become aware of these until a war is underway. Computer applications in music can help to transcribe and compose music as well as provide accompaniment for a musician to practice with.  

Expect the number of computer applications in all of these fields to become more common in the future. Expect many applications to take the place of people to save money in a cash-crunched economy where everyone is looking for more ways to save money and cut costs.

Explanation:

Explain how data is represent in the computer system

Answers

Explanation:

Computers use binary - the digits 0 and 1 - to store data. A binary digit, or bit, is the smallest unit of data in computing. It is represented by a 0 or a 1. Binary numbers are made up of binary digits (bits), eg the binary number 1001.

what is falg register​

Answers

Answer:

I dont know the answer

Explanation:

I dont know the answer

If you meant “FLAGS register”, it’s the status register in Intel x86 microprocessors. It contains the current state of the processor.

A slide titled Alexander Graham Bell. There are 6 bulleted entries on the slide, and there is a lot of text on the slide. There is very little space around the text to the edges of the slide. There is no image on the slide and the text is shaded white on a blue background.
This slide has several design problems, according to the design principles that were just reviewed. What are the problems? Check all that apply.

The slide contains too much text.
The slide does not have an image or visual aid.
The text is too small.
The background makes it hard to read the text.
The slide does not have enough empty space.

Answers

Answer:

The following are design problems associated with the Alexander Graham Bell slide:

The slide contains too much text.

The slide does not have an image or visual aid.

The background makes it hard to read the text.

The slide does not have enough empty space.

Explanation:

Answer:

It's not ABDE, it's ABE

Explanation:

i tried it

"We can't a computer use source code

Answers

Answer:

Explanation:

There are two main reasons why you can't access the source code from applications on your computer: It isn't present on your computer. The source code isn't really needed to run the application, the executable is (.exe) The executable is just a bunch of machine code stuff that isn't human readable.

I this is .exe hope it helps

Write a program named Twitter that accepts a user’s message and determines whether it is short enough for a social networking service that does not accept messages of more than 140 characters.

If the message is more than 140 characters, output The message is too long. Otherwise output The message is okay.

Answers

Explanation:

It's a very easy one, Liev:

using System;

class Twitter

{

static void Main()

{

Console.WriteLine("Enter your message");

Console.WriteLine();

string message = Console.ReadLine();

Console.WriteLine();

if (message.Length <= 140)

{

Console.WriteLine("Yes, it's short enough for Twitter");

}

else

{

Console.WriteLine("Sorry, it's too long for Twitter");

}

Console.ReadKey();

}

}

You are given a 5-letter word (for example, abcde). Write a C-Program which outputs all possible unique 5 letter permutations of this word in a text file. There should be no repetition of letters in permutation (i.e. in our example, bacde is a valid permutation but bbcde is invalid. Use of library functions for generation of permutations is NOT allowed.
The text file containing the output should be named as q3out.txt. Each word of the output must be on a separate line in the text file. The 5-letter input word should be read by your program from the console. Provide comments in your code. Submit your C code, and the q3out.txt file for the following inputs:
(a) parba
(b) arbca

Answers

Answer:

See attachment 1 for code

See attachment 2 for the output of permuting letters of parba

See attachment 3 for the output of permuting letters of arbca

Explanation:

The program was implemented in C

The program uses a recursive function letterpermutation and a swap function to successfully implement the requirement of this question.

The letterpermutation function is defined here

void letterpermutation(char *mystring, int index1, int index2) {  

This lets the program writes to a file

  FILE *fptr;

This opens the file in an appending mode

  fptr = fopen("q3out.txt","a");

int i;

This checks for unique strings.

if (index1 == index2) {

If found, this appends the string to the text file

   fprintf(fptr,"%s\n",mystring); }

If otherwise

else{  

This iterates through the string

for (i = index1; i <= index2; i++)   {

The swap function is called to swap the characters of the string

 swap((mystring+index1), (mystring+i));  

This calls the function, recursively

letterpermutation(mystring, index1+1, index2);  

This further swaps the characters of the string

swap((mystring+index1), (mystring+i));  

} } }  

The swap function begins here and what it literally does is that it swaps characters of the input string to create a new string

void swap(char *ch1, char *ch2) {  

char temp;  

temp = *ch1;  *ch1 = *ch2;  *ch2 = temp; }

The main function begins here

int main() {  

This declares and initializes the string

char mystring[] = "ABCd"; // The string here can be changed

This calls the function to permute the string

letterpermutation(mystring, 0, strlen(mystring)-1);  

return 0; }

what is the command used to retrieve the java files along with the string existence "Hello world" in it​

Answers

Answer:

java” xargs grep -i "Hello World”

The information in DNA Is coded in chemical bases adenosine (A) guanine (G) cytosine (C), and thymine (T) We can represent a DNA strand by stringing together the letters representing the appropriate strand. Imagine we are given a list of DNA strands which have arbitrary lengths. Write a single function strand_counter() which takes a list of DNA strands, counts the lengths of each of the words in the list and then calculates and returns the integer maximum_length integer minimum_length, and float average_length
Then write a program which takes in a user-chosen number of strands of arbitrary length as an input and prints out the calculated information
Example input
5
AT
ATCGTCOGGT
TCGCT
TCGATTCCT
TTCATCG
Example output
The longest strand has length 10.
The shortest strand has length 2.
The average length of the strands is 6.6.

Answers

Answer:

c

Explanation:

i think i leard it out my old shcool

Which three major objects are built into the JavaScript language?
This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task are A to H and alt+1 to alt+9.
A

Document, Object, Model.
B

Canvas, Geolocation and Drag.
C

None, JavaScript is object-based not object-oriented.
D

Document, Navigator, Array.

Answers

Answer:

jddjjddjdjdjjsjsjejejejjejejejjdjdjeje

Pretty sure, the answer is: None, JavaScript is object-based not object-oriented.

What are the 3 biggest advancements in computers?

Answers

Answer:

abacus . Mesopotamia or China, possibly several thousand years BCE. ...

binary math . Pingala, India, 3rd century BCE. ...

punched card . Basile Bouchon, France, 1725. ...

Explanation:

:)

dy
If x2 - y2 = 1, then
dx
1
(a) yx-1
(C) xy-1
(b) -xy-
(d) - yx​

Answers

Answer:

xy-1

Explanation:

Given expression is :

[tex]x^2-y^2=1[/tex] ..(1)

We need to find the value of [tex]\dfrac{dy}{dx}[/tex].

Differentiating equation (1) wrt x.

[tex]\dfrac{d}{dx}(x^2-y^2)=1\\\\2x-2y\times \dfrac{dy}{dx}=0\\\\2y\times \dfrac{dy}{dx}=2x\\\\y\times \dfrac{dy}{dx}=x\\\\\dfrac{dy}{dx}=\dfrac{x}{y}[/tex]

or

[tex]\dfrac{dy}{dx}=xy^{-1}[/tex]

Hence, the correct option is (c) "xy-1".

Other Questions
A person invested $540 in an account growing at a rate allowing the money to doubleevery 9 years. How much money would be in the account after 21 years, to the nearestdollar? Help me solve this problem please Give an example of an Evaluative Language. How do you know the example is an Evaluative Language? I need an answer ASAP Before radio, many minority musicians were severely limited by the prejudice of the era.TrueFalse NEED HELP ASAP I WILL GIVE BRAINLIST Which of the following is part of the digestive system?AdiaphragmBesophagusCaortaDtrachea The measure of an angle is 72 degrees what is the measure of its conplementary angle What is the speed of a rocket that travels 10000 meters in 15 seconds?Help a brother out Why are fossil fuels considered nonrenewable resources? A. They form quickly due to decaying biomass. B. They require both sunlight and water to form. C. They cannot be used to create electricity. D. They take millions of years to form. 3.A balloon is released from the top of a building. The graph shows the height of the balloon over time. What does the slope and y-intercept reveal about the situation?A. The balloon starts at a height of 500 ft and rises at a rate of 300 ft.B. The balloon starts at a height of 500 ft and rises at a rate of 150 ft.C. The balloon starts at a height of 0.05 ft and rises at a rate of 150 ft. You have a restaurant bill of $46.32. If you are taxed 7 1/2 and decide to tip your server 20%, how much is your total?a.$59.75b.$59.05c.$58.92d.$58.87 Between the left atrium and left ventricle, blood flows through the bicuspid valve.TrueFalse The journalist's article, expected to be a harsh ______ of the politician, actually portrayed her in a very positive light. what is the value? when r equals 0 Can someone help meee What is the area of the figure below? The salary of 12workers is $ 3732 . what will be the salary of 5 workers Find the value of k for which equation k2x2+2kx=4x-6 has no real roots. How might the story be different if told from the point of view of a Selenite? Select all that apply.Mr. Bedford and Mr. Cavor would be portrayed as aliens with strange features.The action scenes would portray the Selenites as the victors.The narrator would share the thoughts of Mr. Cavors character.The reader would have to infer the motives of Mr. Bedford and Mr. Cavor for coming to the moon. whats the ninth term of 25 20 15 10 5 Prove (triangle)ABC is congruent to (triangle) DEF using ASA