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
Goryan [66]
3 years ago
5

Write a statement that assigns freeBooks the appropriate value based on the values of the boolean variable isPremiumCustomer and

the int variable nbooksPurchased.
Engineering
1 answer:
solniwko [45]3 years ago
4 0

Write a statement that assigns freeBooks the appropriate value based on the values of the boolean variable isPremiumCustomer and the int variable nbooksPurchased is described below

Explanation:

Online Book Merchants offers premium customers 1 free book with every purchase of 5 or more books and offers 2 free books with every purchase of 8 or more books. It offers regular customers 1 free book with every purchase of 7 or more books, and offers 2 free books with every purchase of 12 or more books.

A statement that assigns freeBooks the appropriate value based on the values of the boolean variable isPremiumCustomer and the int variable nbooksPurchased. Here's what we have:

if(isPremiumCustomer = true){

   if(nbooksPurchased >= 5));

        freeBooks = 1;  

   }else if(nbooksPurchased >= 8){

  freeBooks = 2;

}else {

if(nbooksPurchased >= 7);

  freeBooks = 1;

}else if(nbooksPurchased >= 12){

 freeBooks = 2;

}

We are getting an error of "illegal start of expression".

Two of the hints are "You are using an incorrect number somewhere in your solution" and "We think you might want to consider using: ==".

I do not want the answer, I just want pointed in the right direction.

You might be interested in
For a Cu-Ni alloy containing 53 wt.% Ni and 47 wt.% Cu at 1300°C, calculate the wt.% of the alloy that is solid and wt.% of allo
Zina [86]

Answer:

Hello your question is incomplete attached below is the complete question

answer: wt.% of alloy that is solid = 61.5%

             wt.% of allot that is liquid = 38.5%

Explanation:

To determine the wt.% of the alloy that is solid

= \frac{R}{R +S } * 100

=  \frac{53-45}{58-45} * 100  = 61.5%

To determine the wt.% of the alloy that is liquid

= \frac{S}{S+R} * 100\\

= \frac{58-53}{58-45} *100 = 38.5%

attached below is a free hand sketch as well

7 0
3 years ago
In this homework problem we’ll begin completing an implementation of SimpleList that uses a linked list of Item objects internal
balu736 [363]

The solution contains multiple java files. The initial linked list is 10 20 30 40 . The modified list is 20 30 40

<u>Explanation</u>

//Define the interface SimpleList;

public interface SimpleList

{

   public Object get (int index);

   public void set (int index, Object element);

   public void add (int index, Object element);

   public Object remove(int index);

   public int size();

}

SimpleLinkedList.java:

//Define the class SimpleLinkedList that implements the SimpleList.

public class SimpleLinkedList implements SimpleList

{

   //Define the Item class.

   class Item

   {

       Object value;

       Item next;          

       Item (Object setValue, Item setNext)

       {

           value = setValue;

           next = setNext;

       }

   }      

   protected Item start;

   protected int currentSize;      

   //Define the default constructor.

   public SimpleLinkedList()

   {

       currentSize = 0;

       start = null;

   }      

   //Define the parameterized constructor.

   SimpleLinkedList(Object[] values)

   {

       currentSize = 0;          

       //Start the loop and call the add method.

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

       {

           add(i, values[i]);

       }

   }      

   //Define the method to return the object

   // at the given index.

   atOverride

   public Object get (int index)

   {

       //Call the getItem() method and return it's value.

       return getItem(index).value;

   }      

   //Define the set() method.

   atOverride

   public void set (int index, Object element)

   {

       if (index < 0 || index >= currentSize)

       {

           return;

       }

       int currentIndex = 0;          

       for (Item current = start; current != null; current = current.next)

       {

           if (currentIndex == index)

           {

               current.value = element;

               break;

           }

           currentIndex++;

       }

   }    

   //Define the getItem() method.

   protected Item getItem(int index)

   {

       if (index < 0 || index >= currentSize)

       {

           return null;

       }      

       int currentIndex = 0;        

       for (Item current = start; current != null; current = current.next)

       {

           if (currentIndex == index)

           {

               return current;

           }

           currentIndex++;

       }

       return null;

   }      

   //Define the add() method.

   atOverride

   public void add (int index, Object toAdd)

   {

       if (index == 0)

       {

           start = new Item (toAdd, start);

           currentSize++;

           return;

       }        

       Item previousItem = getItem(index - 1);        

       if(previousItem == null)

       {

           return;

       }          

       Item newItem = new Item(toAdd, previousItem.next);

       previousItem.next = newItem;

       currentSize++;

   }      

   //Define the method to return the size of the linked list.

   atOverride

   public int size ()

   {

       return currentSize;

   }      

   //Define the method to remove an index from the linked list.

   atOverride

   public Object remove (int index) {

       // TODO Auto-generated method stub

       return null;

   }      

}

YourSimpleLinkedList.java:

//Define the YourSimpleLinkedList class.

public class YourSimpleLinkedList extends SimpleLinkedList

{

   //Define the default constructor.s

   public YourSimpleLinkedList()

   {

       super();

   }      

   //Define the parameterized constructor.

   YourSimpleLinkedList(Object[] values)

   {

       super(values);

   }

   //Define the method to remove an index.

   at Override

   public Object remove(int index)

   {

       //Return null if the index is out of range.

       if (index < 0 || index >= currentSize)

       {

           return null;

       }        

       //Set the start Item if the first value

       // is to be removed.

       if (index == 0)

       {

           //Store the value of the node to be removed.

           Object temp = start.value;

           

           //Set the start Item.

           start = start.next;

           

           //Update the size of the linked list and return

           // the deleted value.

           currentSize--;

           return temp;

       }        

       //Initialize the required variables.

       int currentIndex = 0;

       Item current = start;

       Item prev = start;        

       //Start the loop to traverse the list.

       while (current != null)

       {

           //Check the index value.

           if (currentIndex == index)

           {

               //Store the value to be deleted.

               Object temp = current.value;                

               //Set the next pointer.

               prev.next = current.next;                  

               //Update the size of the linked list and return

               // the deleted value.

               currentSize--;

               return temp;

           }            

           //Update the values.

           currentIndex++;

           prev = current;

           current = current.next;

       }

       return null;

   }

}

Main.java:

public class Main

{

   public static void main(String[] args)

   {

       //Create a list of objects.

       Object [] values = {10, 20, 30, 40};          

       //Create an object of the YourSimpleLinkedList class.

       YourSimpleLinkedList myList = new YourSimpleLinkedList(values);        

       //Display the initial list.

       System.out.print("The initial linked list is ");

       for (int i=0;i<myList.size();i++)

       {

           System.out.print(myList.get(i) + " ");

       }        

       //Remove an index from the list.

       myList.remove(0);        

       //Display the modified list.

       System.out.println();

       System.out.print("The modified list is ");

       for (int i=0;i<myList.size();i++)

       {

           System.out.print(myList.get(i) + " ");

       }

   }  

}

5 0
4 years ago
Consider a single, porous, spherical, inert mineral particle. The pores inside the particle are filled with liquid water (specie
cluponka [151]

Answer:

Explanation:

kindly check the attachment below for detailed explanations. Thanks

7 0
4 years ago
QUESTIONS
tigry1 [53]

the answer is C cause drivers dont always follow the rules

8 0
4 years ago
Consider a solid round elastic bar with constant shear modulus, G, and cross-sectional area, A. The bar is built-in at both ends
Ierofanga [76]

Answer:

\t(x)_{max} =\dfrac{p\times L}{2\times \pi}

Explanation:

Given that

Shear modulus= G

Sectional area = A

Torsional load,

t(x) = p sin( \frac{2\pi}{ L} x)

For the maximum value of internal torque

\dfrac{dt(x)}{dx}=0

Therefore

\dfrac{dt(x)}{dx} = p cos( \frac{2\pi}{ L} x)\times \dfrac{2\pi}{L}\\ p cos( \frac{2\pi}{ L} x)\times \dfrac{2\pi}{L}=0\\cos( \frac{2\pi}{ L} x)=0\\ \dfrac{2\pi}{ L} x=\dfrac{\pi}{2}\\\\x=\dfrac{L}{4}

Thus the maximum internal torque will be at x= 0.25 L

t(x)_{max} = \int_{0}^{0.25L}p sin( \frac{2\pi}{ L} x)dx\\t(x)_{max} =\left [p\times \dfrac{-cos( \frac{2\pi}{ L} x)}{\frac{2\pi}{ L}}  \right ]_0^{0.25L}\\t(x)_{max} =\dfrac{p\times L}{2\times \pi}

6 0
3 years ago
Other questions:
  • Peter the postman became bored one night and, to break the monotony of the night shift, he carried out the following experiment
    9·1 answer
  • An online identity is different and separate from an online profile
    12·1 answer
  • A fiberglass composite is composed of a matrix of vinyl ester and reinforcing fibers of E-glass. The volume fraction of E-glass
    10·1 answer
  • Calculate the force of attraction between a Ca^2+ and an 0^2- irons whose centers are sep by a distance of 1.25 nm.
    7·1 answer
  • When moving cylinders always remove and make
    8·1 answer
  • write a paragraph on how iron and copper(separately) is manufactured, what it consists of and processes that it went through to
    6·1 answer
  • Stucco will shrink as it hardens and cures.<br> A. true<br> B. false
    11·1 answer
  • What information you would gain by watching the video. Plz Help due today.
    6·1 answer
  • Congress can pass laws concerning ___. (Select all that apply.)
    13·1 answer
  • Free poînts lol Philippînes - cool<br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!