answer.
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
soldi70 [24.7K]
2 years ago
11

If productCost and productPrice are numeric variables, and productName is a string variable, which of the following statements a

re valid assignments? If a statement is not valid, explain why not.
a. productCost =100
b. productPrice= productCost
c. productPrice= productName
d. productiPrice =24.95
e. 15.67= productCost
f. productCost= $ 1,345.52
g. product Cost= productPrice -10
h. productName= "mouse pad"
i. productCost + 20= productPrice
j. productName= 3 -inch natis
k. productName =43
l. productName =" 44 n
m. " 99 "= productName
Computers and Technology
1 answer:
VLD [36.1K]2 years ago
7 0
<h2>Question: </h2>

a. productCost = 100

b. productPrice = productCost

c. productPrice = productName

d. productPrice = “24.95”

e. 15.67 = productCost

f. productCost = $1, 345.52

g. product Cost = productPrice − 10

h. productName = “mouse pad”

i. productCost + 20 = productPrice

j. productName = 3-inch nails

k. productName = 43

l. productName = “44”

m.“99” = productName

Answer:

(a) valid

(b) valid

(c) invalid

(d) valid

(e) invalid

(f) invalid

(g) invalid

(h) valid

(i) invalid

(j) invalid

(k) invalid

(l) valid

(m) invalid

Explanation:

(a) valid. Since productCost is a numerical variable, a value of 100 can be assigned to it.

(b) valid. Both productCost and productPrice are numerical variables and as such value of one can be stored in the other.

(c) invalid. productName is a string variable and cannot be directly assigned to productPrice which is a numeric variable.

(d) valid. productPrice is a numeric variable and 24.95 can be assigned to it.

(e) invalid. 15.67 is not a variable name and as such cannot have values assigned to it.

(f) invalid. $ and , are not numeric digits and as such cannot be assigned to productCost which is numeric.

(g) invalid. There should be no space between product and Cost. It should be productCost and not product Cost.

(h) valid. "mouse pad" is a string literal and can be assigned to productName which is a string variable.

(i) invalid. productCost + 20 is not a variable .

(j) invalid. 3-inch nails should be in quotes for it to be assignable to productName.

(k) invalid. 43 is a numeric literal and cannot be directly assigned to productName which is a string variable. In other words, 43 should be in quotes for it to be assignable to productName.

(l) valid. 44 (in quotes) is a string literal and can be assigned to productName which is a string variable.

(m) invalid. "99" is not a variable name and cannot hold or be assigned any value.

You might be interested in
Row array gameScores contains all player scores. Construct a row array highScores than contains all player scores greater than m
Sever21 [200]

Answer:

The solution is written using Python as it has a simple syntax.

  1. def getHighScores(gameScores, minScore):
  2.    meetsThreshold = []
  3.    for score in gameScores:
  4.        if(score > minScore):
  5.            meetsThreshold.append(score)
  6.    return meetsThreshold
  7. gameScores = [2, 5, 7, 6, 1, 9, 1]
  8. minScore = 5
  9. highScores = getHighScores(gameScores, minScore)
  10. print(highScores)

Explanation:

Line 1-8

  • Create a function and name it as <em>getHighScores</em> which accepts two values, <em>gameScores</em> and <em>minScore</em>. (Line 1)
  • Create an empty list/array and assign it to variable <em>meetsThreshold</em>. (Line 2)
  • Create a for loop to iterate through each of the score in the <em>gameScores</em> (Line 4)
  • Set a condition if the current score is bigger than the <em>minScore</em>, add the score into the <em>meetsThreshold</em> list (Line 5-6)
  • Return <em>meetsThreshold</em> list as the output

Line 11-12

  • create a random list of <em>gameScores</em> (Line 11)
  • Set the minimum score to 5 (Line 12)

Line 13-14

  • Call the function <em>getHighScores()</em> and pass the<em> gameScores</em> and <em>minScore </em>as the arguments. The codes within the function <em>getHighScores()</em>  will run and return the <em>meetsThreshold </em>list and assign it to <em>highScores.</em> (Line 13)
  • Display <em>highScores</em> using built-in function print().
8 0
2 years ago
Given that a method receives three parameters a, b, c, of type double, write some code, to be included as part of the method, th
Debora [2.8K]

Answer and Explanation:

class Dis

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter values for a,b,c");

double a=sc.nextDouble();

double b=sc.nextDouble();

double c=sc.nextDouble();

String s=discriminant(a,b,c);

System.out.println(s);

}

public String discriminant(double a, double b, double c)

{

double result;

result=(b^2-4ac);

if(result<0)

return "no real solutions"";

else return "";

}

}

Note:This program is written in JAVA

6 0
2 years ago
Read 2 more answers
Name and summarize the four levels of administration necessary to keep human services organization operating smoothly
aliina [53]
The four levels of organization incorporate official chiefs, program executives, improvement chiefs, and give essayists. The meaning of business organization is a program of study offered at colleges and schools that attention on business hypothesis, practices, and administration. A case of business organization is a class on the standards of bookkeeping.
3 0
2 years ago
Read 2 more answers
After modifying a numbered list in her presentation, Su notices the numbers and the text are too close to each other. She knows
IrinaK [193]

Answer:

1. View, show

2. to the right

Explanation:

On edg

8 0
2 years ago
Recall that a Set is an abstract data type somewhat similar to a Bag, they can store a finite collection of objects without any
lina2011 [118]

Answer:

Here is the addLikeASet() method:

public boolean addLikeASet(T anEntry){  // method takes the T parameter anEntry

       boolean res = true;  //sets the result to true

       if(Arrays.asList(bag).contains(anEntry);  {  //checks if the bag already contains anEntry

           res=false;         }  //returns false

       else         {   if the bag does not already contain anEntry

           bag[numberOfEntries]=anEntry;  //enters the anEntry in bag array

           numberOfEntries++;         }  //increments the  numberOfEntries by 1

       return res;     } //returns true

Explanation:

You can also implement this method like this:

public boolean isFilled(){ // the function to check if the bag is full

       return numberOfEntries == bag.length;  } // number of entries equals length of the bag which shows that the bag is full

public boolean addLikeASet(T anEntry){

       boolean res=true;

       if (!isFilled() || (Arrays.asList(bag).contains(anEntry));  //checks if the bag is full or contains anEntry already

           res=false;         //returns false

       else         { if bag does not already contain anEntry

           bag[numberOfEntries]=anEntry; //add anEntry to the bag

           numberOfEntries++;         } add 1 to the count of numberOfEntries

       return res;     } //returns true

You can also use a loop to check if anEntry is already present in bag:

for(int i=0; i< bag.length; i++)  {

    if(anEntry.equals(bag[i])) {

      return false;      }    }  

  return true;

3 0
2 years ago
Other questions:
  • Two career fields that lack minority professionals and thus offer many grant opportunities to students are education and _____.
    10·2 answers
  • The overall purpose of CSS is to modify the way web pages look without modifying the underlying HTML code. way tables render in
    12·2 answers
  • Interpretations of​ Moore's law assert​ that:
    13·1 answer
  • How many times does the following loop execute?int upperCaseLetters = 0;String str = "abcdEfghI";boolean found = false;for (int
    5·1 answer
  • Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i
    8·1 answer
  • Earlier in the day, you created a user account for Brenda Cassini (bcassini). When she tries to log in, she can't. You realize t
    9·2 answers
  • Within a word processing program, predesigned files that have layout and some page elements already completed are called text bo
    15·1 answer
  • Write a statement that assigns total_coins with the sum of nickel_count and dime_count. Sample output for 100 nickels and 200 di
    11·1 answer
  • What answer best explains why improper netiquette is considered dangerous? Individuals who violate user policies are often charg
    14·2 answers
  • Evie clicks through her presentation slides and realizes they all have transition effects coming from the same location, from th
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!