1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
postnew [5]
3 years ago
14

Write a program that reads in 10 numbers and displays the number of distinct numbers and the distinct numbers in their input ord

er and separated by exactly one space (i.e., if a number appears multiple times, it is displayed only once). After the input, the array contains the distinct numbers. Here is a sample run of the program.
Computers and Technology
1 answer:
Alla [95]3 years ago
8 0

Answer:

Explanation:

The following code is written in Python. It creates a for loop that iterates 10 times, asking the user for a number every time. It then checks if the number is inside the numArray. If it is not, then it adds it to the array, if it is then it skips to the next iteration. Finally, it prints the number of distinct numbers and the list of numbers.

numArray = []

for x in range(10):

   num = input("Enter a number")

   if int(num) not in numArray:

       numArray.append(int(num))

print("Number of Distince: " + str(len(numArray)))

for num in numArray:

   print(str(num), end = " ")

You might be interested in
NEED HELP ASAP!!!
Triss [41]

Answer:

Feet & Inches

4). Millimeters

5). Pixels

3 0
2 years ago
Please debug the below code in Java please.
lisabon 2012 [21]

Answer:

Check the explanation

Explanation:

//Bugs are highlighted in bold text

class Invoice

Declarations

private num invoiceNumber

private string customer

private num balanceDue

private num tax

public void setInvoiceNUMBER(num number)

Declarations

num LOW_NUM = 1000

num HIGH_NUM = 9999

if number > HIGH_NUM then

invoiceNumber = 0

else

if number < LOW_NUM then

invoiceNumber = 0

else

invoiceNumber = num

endif

return

public void setCustomer(string cust)

customer = cust

return

public void setBalanceDue(num balance)

//Bug balanceDue is Invoice class varible

//but it is assigned to balance .it gives error

balance = balanceDue

setTax()

return

private void setTax()

Declarations

//Bug TAX_RATE is declared as string

//but assigned a double value

string TAX_RATE = 0.07

tax = tax * TAX_RATE

return

public void displayInvoice()

output "Invoice #", invoiceNumber

output "Customer: ", customer

output "Due: ", balanceDue

output "Tax: ", taxDue

//Bug

//Invoice class has no variable called balance .it should be balanceDue

output "Total ", balance + taxDue

return

endClass

start

Declarations

Invoice inv1

Invoice inv2

Invoice inv3

//Warning

//it gives warning object taken but not initilaized

Invoice inv4

inv1.setInvoiceNumber(1244)

inv1.setCustomer("Brown")

inv1.setBalanceDue(1000.00)

inv1.displayInvoice()

inv2.setInvoiceNumber(77777)

inv2.setCustomer("Jenkins")

inv2.setBalanceDue(2000.00)

inv2.displayInvoice()

inv3.setInvoiceNumber(888)

inv3.setCustomer("Russell")

inv3.setBalanceDue(3000.00)

//Bug

//setTax method of Invioce doesnot take any arguments

inv3.setTax(210.00)

inv3.displayInvoice()

stop

//Here is the complete program in c++

//Run the program using Microsoft visual studio 2010 vc++

#include<iostream>

#include<iomanip>

#include<string>

using namespace std;

class Invoice

{

//class varibales

private:

           int invoiceNumber;

           string customer;

           double balanceDue;

           double tax;

//class methods

public:

           void setCustomer(string cus);

           void displayInvoice();

           void setBalanceDue(double balance);

           void setInvoiceNUMBER(int number);

           void setTax();

};

void Invoice::displayInvoice()

{

cout<< setw(10)<<"Invoice #"<<setw(5)<<invoiceNumber<<endl;

cout<<setw(10)<<"Customer: "<<setw(5)<<customer<<endl;

cout<<setw(10)<<"Due: "<<setw(5)<<balanceDue<<endl;

cout<<setw(10)<<"Tax: "<<setw(5)<<tax<<endl;

//Bug

//Invoice class has no variable called balance .it should be balanceDue

cout<< "Total "<< balanceDue + tax<<endl;

}

void Invoice::setCustomer(string cust)

{

customer = cust;

}

void Invoice::setInvoiceNUMBER(int number)

{

const int LOW_NUM = 1000;

const int HIGH_NUM = 9999;

if( number > HIGH_NUM )

invoiceNumber = 0;

else

if (number < LOW_NUM )

       invoiceNumber = 0;

else

   invoiceNumber = number;

}

void Invoice::setBalanceDue(double balance)

{

balanceDue = balance;

}

void Invoice::setTax()

{

double TAX_RATE = 0.07;

tax = balanceDue * TAX_RATE;

}

int main()

{

Invoice inv1;

Invoice inv2;

Invoice inv3;

inv1.setInvoiceNUMBER(1244);

inv1.setCustomer("Brown");

inv1.setBalanceDue(1000.00);

inv1.setTax();

inv1.displayInvoice();

inv2.setInvoiceNUMBER(77777);

inv2.setCustomer("Jenkins");

inv2.setBalanceDue(2000.00);

inv2.setTax();

inv2.displayInvoice();

inv3.setInvoiceNUMBER(888);

inv3.setCustomer("Russell");

inv3.setBalanceDue(3000.00);

inv3.setTax();

inv3.displayInvoice();

system("pause");

return 0;

}

Kindly check the output image below.

5 0
3 years ago
Does nest cam outdoor connect to a security camera prewire
yawa3891 [41]
Answer: hi there! Have a good day/night :))
6 0
2 years ago
What is the decimal equivalent of 11BA?
allsm [11]

Answer:

To convert hexadecimal number 11BA to decimal, follow these two steps:

Start from one's place in 11BA : multiply ones place with 16^0, tens place with 16^1, hundreds place with 16^2 and so on from right to left

Add all the product we got from step 1 to get the decimal equivalent of 11BA.

Using the above steps, here is the work involved in the solution for converting 11BA to decimal number (Don't forget that we start from ones place to so on...)

Decimal equivalent of "A" = (A) 10 × 16^0 = 10

Decimal equivalent of "B" = (B) 11 × 16^1 = 176

Decimal equivalent of "1" = 1 × 16^2 = 256

Decimal equivalent of "1" = 1 × 16^3 = 4096

Decimal equivalent of "11BA" = 409625617610

11BA = 4538

Here is the final answer, The hexadecimal number 11BA converted to decimal is therefore equal to:

4538

4 0
2 years ago
Choose a firewall that is currently on the market and write a technical "sales pitch" to your classmates on why they should choo
stellarik [79]

Answer:

I would propose Comodo Firewall to my schoolmate. It is very easy to understand and have an appealing graphical UI. It gives the most significant level of security from dangers. It checks all the traffic going to the framework and leaving the framework. It quickly cautions you when there is any sort of suspicious action. There are no mind boggling design issues. It learns the conduct of the client to convey customized protection. It gives you the usefulness of Spyware filtering and infection checking in a single tick. There are a lot more functionalities that the firewall gives to its clients.

Explanation:

Choose a firewall that is currently on the market and write a technical "sales pitch" to your classmates on why they should choose the firewall you are selling.

I would propose Comodo Firewall to my schoolmate. It is very easy to understand and have an appealing graphical UI. It gives the most significant level of security from dangers. It checks all the traffic going to the framework and leaving the framework. It quickly cautions you when there is any sort of suspicious action. There are no mind boggling design issues. It learns the conduct of the client to convey customized protection. It gives you the usefulness of Spyware filtering and infection checking in a single tick. There are a lot more functionalities that the firewall gives to its clients.

3 0
3 years ago
Other questions:
  • 1).
    12·1 answer
  • Your browsing the Internet and realize your browser is not responding which of the following will allow you to immediately exit
    14·2 answers
  • An identifying value called a/an ____ is assigned by the java runtime to an object when it is created, to allow the java runtime
    14·1 answer
  • Which statement about images is correct? A) A virtual image cannot be formed on a screen. B) A virtual image cannot be viewed by
    12·1 answer
  • What is a Hard Drive
    13·1 answer
  • How do I start conversations with ppl??? If u answer right I will try send u more points... So please help me
    7·1 answer
  • Use the drop-down menus to complete the statements about changing mail options in Outlook.
    10·1 answer
  • How to improve a poor game design puzzles
    11·1 answer
  • Help me please. I'LL MARK BRAINIEST
    15·1 answer
  • Which of the following statements is true about the code used for software development?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!