6 kyu

Old Mobile Display

97 of 207mmalkavian

Description:

In this Kata, you need to simulate an old mobile display, similar to this one:

***************************
*                         *
*                         *
*        CodeWars         *
*                         *
*                         *
* Menu           Contacts *
***************************

Input Parameters:

  • number of characters for width (n)
  • height-to-width ratio in percentage (p)

Example: if n=30 and p=40, then display will be 30 characters large and its height will be 40% of n.

Rules and Notes:

  • the border, as you can see, is filled with *;
  • the rounding of divisions and float numbers is always by the integer (1.2, 1.5, 1.9 they are always reduced to 1), keep this in mind when you calculate proportions; for Python: always multiply first, then divide.
  • the menus Menu and Contacts are always in the second last line, at 1 character distance respectively from the left and from the right border;
  • the CodeWars logo is always in the middle horizontally and in the half-1 line vertically;
  • the width n must be always at least 20 characters and the percentage p must be always at least 30%, take care of this (otherwise menus won't likely fit).
  • random tests might get big and percentages might be higher than 100;

OFF-TOPIC before Examples:

A bit of advertisement for an old unnoticed Kata that I translated from Python to Javascript: Character Counter and Bars Graph

Examples:

  • mobileDisplay(30,40):
******************************
*                            *
*                            *
*                            *
*                            *
*          CodeWars          *
*                            *
*                            *
*                            *
*                            *
* Menu              Contacts *
******************************
  • mobileDisplay(25,50):
*************************
*                       *
*                       *
*                       *
*                       *
*       CodeWars        *
*                       *
*                       *
*                       *
*                       *
* Menu         Contacts *
*************************
Strings
ASCII Art
Fundamentals

Stats:

CreatedDec 12, 2016
PublishedDec 12, 2016
Warriors Trained645
Total Skips27
Total Code Submissions2459
Total Times Completed207
Python Completions97
JavaScript Completions75
Java Completions54
Total Stars29
% of votes with a positive feedback rating83% of 76
Total "Very Satisfied" Votes55
Total "Somewhat Satisfied" Votes16
Total "Not Satisfied" Votes5
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • mmalkavian Avatar
  • tachyonlabs Avatar
Ad