Untitled document

1 answer below »
Attached assignment has all questions


Untitled document
Answered 1 days AfterOct 08, 2021

Answer To: Untitled document

Ketaki answered on Oct 10 2021
128 Votes
import java.util.*;
public class Main//DigitToSevenDisplay
{
    public static void main(String[] args) throws Exception
    {
        int i,j,d=0,n=0;
        Scanner inr=new Scanner(System.in);
        System.out.println("Welcome to my seven segment Display\n\nPlease Enter the Length of Horizontal S
egments(from 3 to 40):");
        int lh = inr.nextInt();
        if(lh<3 && lh>40)
        {
            System.out.println("Wrong input for horizontal segments");
        }
        else
        {
            System.out.println("Now Enter the Length of Vertical Segments(from 3 to 40):");
            int lv = inr.nextInt();
            if((lv<3 && lv>40) || (lv>(2*lh)) || (lv<(0.5*lh)))
            {
                System.out.println("Wrong input for vertical segments");
            }
            else
            {
                do
                {
                    System.out.println("Enter Digit");
                    n = inr.nextInt();
                    d=n/10;
                    if(d>0)
                    {
                        System.out.println("User input of digits is not acceptable");
                    }
                    else
                    {
                        switch(n)
                        {
                             case 0:
                            System.out.print(" ");
                            for(i=0;i                            {
                                System.out.print("*");
                            }
                            System.out.print("\n");
                        
                            for(j=0;j                            {    
                                System.out.print("*");
                                for(i=0;i                            {
                                System.out.print(" ");
                            }
                            System.out.print("*\n");
                            }
                            for(i=0;i                            {
                                System.out.print(" ");
                            }
                            System.out.print("\n");
                            
                            for(j=0;j                            {    
                                System.out.print("*");
                                for(i=0;i                                {
                                    System.out.print(" ");
                                }
                                System.out.print("*\n");
                            }
                            System.out.print(" ");
                            for(i=0;i                            {
                                System.out.print("*");
                            }
                        break;
                    
                        case 1:
                            System.out.print(" ");
                            for(i=0;i                            {
                                System.out.print(" ");
                            }
                            System.out.print("*\n");
                    
                            for(j=0;j                            {    
                                System.out.print(" ");
                                for(i=0;i                                {
                                    System.out.print(" ");
                                }
                                System.out.print("*\n");
                            }
                            for(i=0;i                            {
                                System.out.print(" ");
                            }
                            System.out.print("\n");
                            for(j=0;j                            {    
                                System.out.print(" ");
                                for(i=0;i                                {
                                    System.out.print(" ");
                                }
                                System.out.print("*\n");
                            }
                            System.out.print(" ");
                            for(i=0;i                            {
                                System.out.print(" ");
                            }
                            System.out.print("*\n");
                     break;
                    
                        case 2:
                            System.out.print(" ");
                            for(i=0;i                            {
                                System.out.print("*");
                            }
                            System.out.print("\n");
                    
                            for(j=0;j                            {    
                                System.out.print("...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here